Commit a90277df by Wim Coekaerts Committed by Stéphane Graber

criu.c: protect from buffer overrun of version in fscanf()

while highly unlikely to happen... char version[1024]; fscanf(.. %[1024] .., version ); should leave room for null termination Signed-off-by: 's avatarWim Coekaerts <wim.coekaerts@oracle.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 2984ee36
......@@ -315,7 +315,7 @@ static bool criu_version_ok()
return false;
}
if (fscanf(f, "Version: %1024[^\n]s", version) != 1)
if (fscanf(f, "Version: %1023[^\n]s", version) != 1)
goto version_error;
if (fgetc(f) != '\n')
......@@ -324,7 +324,7 @@ static bool criu_version_ok()
if (strcmp(version, CRIU_VERSION) >= 0)
goto version_match;
if (fscanf(f, "GitID: v%1024[^-]s", version) != 1)
if (fscanf(f, "GitID: v%1023[^-]s", version) != 1)
goto version_error;
if (fgetc(f) != '-')
......
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