2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-29 05:17:59 +00:00

Ensure that the buffer read from /proc/sys/kernel/osrelease is null terminated

Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2011-03-03 15:53:23 -08:00
parent 174c89f772
commit 9819bf5df0

View File

@ -237,6 +237,7 @@ static size_t kernel_af_max(void) {
close(fd);
if (!res)
return 0;
buffer[sizeof(buffer)-1] = '\0';
res = sscanf(buffer, "2.6.%d", &major);
if (res != 1)
return 0;