From: Andi Gutmans Date: Sun, 27 Aug 2000 04:14:47 +0000 (+0000) Subject: - Fix possible overflow in fsockopen(). X-Git-Tag: php-4.0.2~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b79db079a6743ae3b1526cd19b5e46e0a3925b18;p=php - Fix possible overflow in fsockopen(). --- diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index e8f5aac2ce..7f8445e8de 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -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);