unix: fix buffer overrun in uv__strlcpy()

Reported by Thomas Shinnick.
This commit is contained in:
Ben Noordhuis 2011-09-06 15:44:47 +02:00
parent e8ab5cbe70
commit cc91989cc2

View File

@ -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';