]> granicus.if.org Git - php/commitdiff
MFH: Fixed possible overflow.
authorIlia Alshanetsky <iliaa@php.net>
Tue, 3 Feb 2004 14:44:17 +0000 (14:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 3 Feb 2004 14:44:17 +0000 (14:44 +0000)
ext/snmp/snmp.c

index 0bfc8d3a5233acf34c75972db656c289eeaebbe1..178f1894963bb9287637f6c99f6428c2043fcc0c 100644 (file)
@@ -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);
        }