Commit 08ddf801 by Serge Hallyn Committed by Stéphane Graber

cgm_get: make sure @value is null-terminated

Previously this was done by strncpy, but now we just read the len bytes - not including \0 - from a pipe, so pre-fill @value with 0s to be safe. This fixes the python3 api_test failure. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent fb6c7616
......@@ -806,6 +806,7 @@ static int cgm_get(const char *filename, char *value, size_t len, const char *na
close(p[0]);
return newlen;
}
memset(value, 0, len);
if (newlen < 0) { // child is reporting an error
close(p[0]);
return -1;
......
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