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

From: Date: Wed, 27 Aug 2014 02:36:44 +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-81179@lists.php.net to get a copy of this message
Commit: 7325578bbad2a3e6ccbf860be6b553b2a75398d5 Author: Stanislav Malyshev <stas@php.net> Mon, 18 Aug 2014 23:04:24 -0700 Committer: Ferenc Kovacs <tyrael@php.net> Wed, 27 Aug 2014 04:36:44 +0200 Parents: 2c27515409b1d8cf329d7153aad2aca4a2b3774f Branches: PHP-5.6.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7325578bbad2a3e6ccbf860be6b553b2a75398d5 Log: fix potentially missing NUL termination Changed paths: M main/network.c Diff: diff --git a/main/network.c b/main/network.c index fc2a94b..f833644 100644 --- a/main/network.c +++ b/main/network.c @@ -992,6 +992,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 @@ -1016,6 +1017,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 (#81179) next »