From: hno <> Date: Wed, 13 Feb 2002 07:41:31 +0000 (+0000) Subject: Fix a minor off-by-one/C-style-string-assumption error in SNMP X-Git-Tag: SQUID_3_0_PRE1~1197 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b86202ac995eeff95958a424b2bf2f0db391ae18;p=thirdparty%2Fsquid.git Fix a minor off-by-one/C-style-string-assumption error in SNMP community processing --- 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); }