git: c4cae8cbc337 - stable/14 - libbsnmp: avoid division by zero with empty password
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Jan 2025 14:26:25 UTC
The branch stable/14 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=c4cae8cbc337eaf824774fcba88018e42fa31efa
commit c4cae8cbc337eaf824774fcba88018e42fa31efa
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-11 05:08:02 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-01-20 14:25:14 +0000
libbsnmp: avoid division by zero with empty password
PR: 283909
(cherry picked from commit 4dc1820a16b9b6108e0ff8a0265c08c67fa34146)
---
contrib/bsnmp/lib/snmpclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/bsnmp/lib/snmpclient.c b/contrib/bsnmp/lib/snmpclient.c
index ab3ac2d18e64..b312a37ed3ed 100644
--- a/contrib/bsnmp/lib/snmpclient.c
+++ b/contrib/bsnmp/lib/snmpclient.c
@@ -1792,7 +1792,7 @@ snmp_discover_engine(char *passwd)
if (snmp_client.user.auth_proto == SNMP_AUTH_NOAUTH)
return (0);
- if (passwd == NULL ||
+ if (passwd == NULL || strlen(passwd) == 0 ||
snmp_passwd_to_keys(&snmp_client.user, passwd) != SNMP_CODE_OK ||
snmp_get_local_keys(&snmp_client.user, snmp_client.engine.engine_id,
snmp_client.engine.engine_len) != SNMP_CODE_OK)