mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
libbsnmptools: avoid uninitialized snmptoolctx->passwd with empty password
The removed check left snmptoolctx->passwd pointer to uninitialized
memory. Always calling strlcpy(3) would guarantee that with empty
password it will point to empty string.
Submitted by: markj
PR: 283909
(cherry picked from commit 3999a860d6)
This commit is contained in:
parent
c4cae8cbc3
commit
0bfbd30663
1 changed files with 1 additions and 2 deletions
|
|
@ -178,8 +178,7 @@ snmptool_init(struct snmp_toolinfo *snmptoolctx)
|
|||
warn("malloc() failed");
|
||||
return (-1);
|
||||
}
|
||||
if (slen > 0)
|
||||
strlcpy(snmptoolctx->passwd, str, slen + 1);
|
||||
strlcpy(snmptoolctx->passwd, str, slen + 1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue