unix: fix buffer overrun in uv__strlcpy()
Reported by Thomas Shinnick.
This commit is contained in:
parent
e8ab5cbe70
commit
cc91989cc2
@ -764,10 +764,8 @@ size_t uv__strlcpy(char* dst, const char* src, size_t size) {
|
||||
}
|
||||
|
||||
org = src;
|
||||
while (size > 1) {
|
||||
if ((*dst++ = *src++) == '\0') {
|
||||
return org - src;
|
||||
}
|
||||
while (--size && *src) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user