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

From: Date: Tue, 19 Aug 2014 13:03:15 +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-80612@lists.php.net to get a copy of this message
Commit: fc4ded00f8c9b6a3bfcb67a75096c9546ae891a0 Author: Stanislav Malyshev <stas@php.net> Mon, 18 Aug 2014 23:04:24 -0700 Committer: Julien Pauli <jpauli@php.net> Tue, 19 Aug 2014 15:03:15 +0200 Parents: 1daa4c0090b7cd8178dcaa96287234c69ac6ca18 Branches: PHP-5.5.16 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc4ded00f8c9b6a3bfcb67a75096c9546ae891a0 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 (#80612) next »