From b86202ac995eeff95958a424b2bf2f0db391ae18 Mon Sep 17 00:00:00 2001 From: hno <> Date: Wed, 13 Feb 2002 07:41:31 +0000 Subject: [PATCH] Fix a minor off-by-one/C-style-string-assumption error in SNMP community processing --- snmplib/snmp_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c index d5ad882d5b..7b296178e8 100644 --- a/snmplib/snmp_api.c +++ b/snmplib/snmp_api.c @@ -146,6 +146,8 @@ snmp_parse(struct snmp_session * session, if (bufp == NULL) return (NULL); - strcpy((char *) bufp, (char *) Community); + strncpy((char *) bufp, (char *) Community, CommunityLen); + bufp[CommunityLen] = '\0'; + return (bufp); } -- 2.47.3