ext/libuv/src/unix/proctitle.c in libuv-3.1.7 vs ext/libuv/src/unix/proctitle.c in libuv-3.1.8
- old
+ new
@@ -96,10 +96,12 @@
if (buffer == NULL || size == 0)
return -EINVAL;
else if (size <= process_title.len)
return -ENOBUFS;
- memcpy(buffer, process_title.str, process_title.len + 1);
+ if (process_title.len != 0)
+ memcpy(buffer, process_title.str, process_title.len + 1);
+
buffer[process_title.len] = '\0';
return 0;
}