From: Ilia Alshanetsky Date: Tue, 3 Feb 2004 14:44:17 +0000 (+0000) Subject: MFH: Fixed possible overflow. X-Git-Tag: php-4.3.5RC2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e26531e7c3a335e6b1c44e104896f7d63f82d1b2;p=php MFH: Fixed possible overflow. --- diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 0bfc8d3a52..178f189496 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -573,7 +573,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) } snmp_sess_init(&session); - strcpy (hostname, Z_STRVAL_PP(a1)); + strlcpy(hostname, Z_STRVAL_PP(a1), sizeof(hostname)); if ((pptr = strchr (hostname, ':'))) { remote_port = strtol (pptr + 1, NULL, 0); } @@ -889,7 +889,7 @@ static void php_snmpv3(INTERNAL_FUNCTION_PARAMETERS, int st) /* Reading the hostname and its optional non-default port number */ convert_to_string_ex(a1); - strcpy(hostname, Z_STRVAL_PP(a1)); + strlcpy(hostname, Z_STRVAL_PP(a1), sizeof(hostname)); if ((pptr = strchr (hostname, ':'))) { remote_port = strtol (pptr + 1, NULL, 0); }