mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
config: initialize the last element of a config argv as NULL
Now we rely on scanf, that it will initializes a pointer to NULL, when it fails to parse a string, but I can't find in a man page, that it has to do this. Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
@@ -60,8 +60,10 @@ static char ** parse_config(char *filepath)
|
||||
while (1) {
|
||||
while ((isspace(*(line + offset)) && (*(line + offset) != '\n'))) offset++;
|
||||
|
||||
if (sscanf(line + offset, "%m[^ \t\n]s", &configuration[i]) != 1)
|
||||
if (sscanf(line + offset, "%m[^ \t\n]s", &configuration[i]) != 1) {
|
||||
configuration[i] = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (configuration[i][0] == '#') {
|
||||
if (sscanf(line, "%*[^\n]") != 0) {
|
||||
|
Reference in New Issue
Block a user