mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
fix potentially missing NUL termination
This commit is contained in:
parent
706aefb781
commit
2b10db8e10
1 changed files with 2 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue