diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c index 9160f7ea..2ed0b21c 100644 --- a/src/unix/proctitle.c +++ b/src/unix/proctitle.c @@ -98,7 +98,9 @@ int uv_get_process_title(char* buffer, size_t size) { 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;