summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-08-18 23:04:24 -0700
committerStanislav Malyshev <stas@php.net>2014-08-18 23:04:24 -0700
commit2b10db8e1010f55fd534672b8877a356e1118e33 (patch)
tree92ead470ad2f2e90e2c13f2230ba6544f4e41e10 /main
parent706aefb78112a44d4932d4c9430c6a898696f51f (diff)
downloadphp-git-2b10db8e1010f55fd534672b8877a356e1118e33.tar.gz
fix potentially missing NUL termination
Diffstat (limited to 'main')
-rw-r--r--main/network.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main/network.c b/main/network.c
index 59ce12ef20..5e44b0e6a8 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) {