Commit 364790be authored by Konstantin Belousov's avatar Konstantin Belousov
Browse files

pidfile test: guarantee nul termination of the read pid string

PR:	258701
Based on the submission by:	sigsys@gmail.com
MFC after:	1 week
parent d7cf1b26
......@@ -286,7 +286,8 @@ test_pidfile_relative(void)
fd = open(path, O_RDONLY);
if (fd < 0)
return (strerror(errno));
if (read(fd, pid, sizeof(pid)) < 0)
memset(pid, 0, sizeof(pid));
if (read(fd, pid, sizeof(pid) - 1) < 0)
return (strerror(errno));
if (atoi(pid) != getpid())
return ("pid mismatch");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment