]> granicus.if.org Git - php/commitdiff
- Fix possible overflow in fsockopen().
authorAndi Gutmans <andi@php.net>
Sun, 27 Aug 2000 04:14:47 +0000 (04:14 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 27 Aug 2000 04:14:47 +0000 (04:14 +0000)
ext/standard/fsock.c

index e8f5aac2cea9e18786697dc49448523cbd084b4d..7f8445e8de521ee037dfb20853760aa56df34a58 100644 (file)
@@ -307,9 +307,9 @@ static void php_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
                        RETURN_FALSE;
                }
          
-               memset(&unix_addr,(char)0,sizeof(unix_addr));
+               memset(&unix_addr, (char)0, sizeof(unix_addr));
                unix_addr.sun_family = AF_UNIX;
-               strcpy(unix_addr.sun_path, (*args[0])->value.str.val);
+               strlcpy(unix_addr.sun_path, (*args[0])->value.str.val, sizeof(unix_addr.sun_path));
 
                if (connect_nonb(socketd, (struct sockaddr *) &unix_addr, sizeof(unix_addr), &timeout) == SOCK_CONN_ERR) {
                        CLOSE_SOCK(1);