librc: fix potential buffer overflow in pid_is_argv

This fixes #299.
This commit is contained in:
William Hubbs 2019-02-23 17:25:16 -06:00
parent d8dbb890aa
commit 028da5c2e3

View File

@ -59,7 +59,7 @@ pid_is_argv(pid_t pid, const char *const *argv)
free(cmdline);
return false;
}
bytes = read(fd, buffer, sizeof(buffer));
bytes = read(fd, buffer, sizeof(buffer) - 1);
close(fd);
free(cmdline);
if (bytes == -1)