com php-src: fix potentially missing NUL termination: main/network.c

From: Date: Tue, 19 Aug 2014 06:04:24 +0000
Subject: com php-src: fix potentially missing NUL termination: main/network.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-80603@lists.php.net to get a copy of this message
Commit: 2b10db8e1010f55fd534672b8877a356e1118e33 Author: Stanislav Malyshev <stas@php.net> Mon, 18 Aug 2014 23:04:24 -0700 Parents: 706aefb78112a44d4932d4c9430c6a898696f51f Branches: PHP-5.4.32 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2b10db8e1010f55fd534672b8877a356e1118e33 Log: fix potentially missing NUL termination Changed paths: M main/network.c Diff: diff --git a/main/network.c b/main/network.c index 59ce12e..5e44b0e 100644 --- a/main/network.c +++ b/main/network.c @@ -989,6 +989,7 @@ PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize) buf = estrdup(errstr); } else { strncpy(buf, errstr, bufsize); + buf[bufsize?(bufsize-1):0] = 0; } return buf; #else @@ -1013,6 +1014,7 @@ PHPAPI char *php_socket_strerror(long err, char *buf, size_t bufsize) buf = estrdup(sysbuf); } else { strncpy(buf, sysbuf, bufsize); + buf[bufsize?(bufsize-1):0] = 0; } if (free_it) {

« previous php.cvs (#80603) next »