Commit 626ad11b by Christian Seiler Committed by Serge Hallyn

apparmor/attach: make sure buffer is NUL-terminated

parent a0e93eeb
......@@ -42,12 +42,13 @@ again:
}
sz += 1024;
buf = realloc(buf, sz);
memset(buf, 0, sz);
if (!buf) {
ERROR("out of memory");
fclose(f);
return NULL;
}
ret = fread(buf, 1, sz, f);
ret = fread(buf, 1, sz - 1, f);
fclose(f);
if (ret >= sz)
goto again;
......
Markdown is supported
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