git: 4dc1820a16b9 - main - libbsnmp: avoid division by zero with empty password
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Jan 2025 05:33:37 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=4dc1820a16b9b6108e0ff8a0265c08c67fa34146
commit 4dc1820a16b9b6108e0ff8a0265c08c67fa34146
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-11 05:08:02 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-11 05:08:02 +0000
libbsnmp: avoid division by zero with empty password
PR: 283909
---
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)