Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jun 2016 19:31:12 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r301690 - stable/9/usr.sbin/bsnmpd/tools/libbsnmptools
Message-ID:  <201606081931.u58JVCBG076808@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Jun  8 19:31:12 2016
New Revision: 301690
URL: https://svnweb.freebsd.org/changeset/base/301690

Log:
  MFstable/10 r301655:
  
  MFC r299766:
  
  Fix logically dead code pointed out by clang/Coverity
  
  parse_context, parse_user_security: test for validity of results from
  parse_ascii(..) with by casting to int32_t and comparing to -1; comparing
  unsigned types to negative values will always be false.
  
  CID: 1011432, 1011433

Modified:
  stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/usr.sbin/   (props changed)
  stable/9/usr.sbin/bsnmpd/   (props changed)

Modified: stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
==============================================================================
--- stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c	Wed Jun  8 19:24:48 2016	(r301689)
+++ stable/9/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c	Wed Jun  8 19:31:12 2016	(r301690)
@@ -614,8 +614,8 @@ parse_context(struct snmp_toolinfo *snmp
 				warnx("Suboption 'context-engine' - no argument");
 				return (-1);
 			}
-			if ((snmp_client.clen = parse_ascii(val,
-			    snmp_client.cengine, SNMP_ENGINE_ID_SIZ)) < 0) {
+			if ((int32_t)(snmp_client.clen = parse_ascii(val,
+			    snmp_client.cengine, SNMP_ENGINE_ID_SIZ)) == -1) {
 				warnx("Bad EngineID - %s", val);
 				return (-1);
 			}
@@ -653,7 +653,7 @@ parse_user_security(struct snmp_toolinfo
 			}
 			snmp_client.engine.engine_len = parse_ascii(val, 
 			    snmp_client.engine.engine_id, SNMP_ENGINE_ID_SIZ);
-			if (snmp_client.engine.engine_len < 0) {
+			if ((int32_t)snmp_client.engine.engine_len == -1) {
 				warnx("Bad EngineID - %s", val);
 				return (-1);
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606081931.u58JVCBG076808>