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. Reported by: clang, Coverity CID: 1011432, 1011433 MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
81910adfc4
commit
715e3b39a6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299766
@ -616,8 +616,8 @@ parse_context(struct snmp_toolinfo *snmptoolctx __unused, char *opt_arg)
|
||||
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);
|
||||
}
|
||||
@ -655,7 +655,7 @@ parse_user_security(struct snmp_toolinfo *snmptoolctx __unused, char *opt_arg)
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user