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

index ec1f0abb2bc1fd7bf5af291162b3c0f5c9c3f944..94046f20340596d93de91729943a59005fabebd7 100644 (file)
@@ -582,7 +582,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);
        }
@@ -907,7 +907,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);
        }