From owner-svn-src-all@freebsd.org Wed Jun 8 19:31:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48FDAB70812; Wed, 8 Jun 2016 19:31:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A1461F3B; Wed, 8 Jun 2016 19:31:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u58JVCxS076809; Wed, 8 Jun 2016 19:31:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u58JVCBG076808; Wed, 8 Jun 2016 19:31:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201606081931.u58JVCBG076808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 8 Jun 2016 19:31:12 +0000 (UTC) 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 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 19:31:13 -0000 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); }