diff options
author | Stanislav Malyshev <stas@php.net> | 2014-08-18 23:04:24 -0700 |
---|---|---|
committer | Julien Pauli <jpauli@php.net> | 2014-08-19 15:03:15 +0200 |
commit | fc4ded00f8c9b6a3bfcb67a75096c9546ae891a0 (patch) | |
tree | a02b5a1e581f171bf114c5e6c68ad4f09680554d | |
parent | 1daa4c0090b7cd8178dcaa96287234c69ac6ca18 (diff) | |
download | php-git-fc4ded00f8c9b6a3bfcb67a75096c9546ae891a0.tar.gz |
fix potentially missing NUL termination
-rw-r--r-- | main/network.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/main/network.c b/main/network.c index fc2a94badd..f8336442d0 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) { |