proc/sysinfo.c: Fix off-by-one in get_pid_digits().
At "pidbuf[rc] = '\0';" if "rc = read()" returns "sizeof pidbuf" (unlikely to ever happen, but still).
This commit is contained in:
parent
8136a7a664
commit
a33be33885
@ -1140,7 +1140,7 @@ unsigned get_pid_digits(void){
|
||||
ret = 5;
|
||||
fd = open("/proc/sys/kernel/pid_max", O_RDONLY);
|
||||
if(fd==-1) goto out;
|
||||
rc = read(fd, pidbuf, sizeof pidbuf);
|
||||
rc = read(fd, pidbuf, sizeof pidbuf - 1);
|
||||
close(fd);
|
||||
if(rc<3) goto out;
|
||||
pidbuf[rc] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user