fixed strcat null possibility in main()
This commit is contained in:
parent
df928892e8
commit
4170970c85
1 changed files with 4 additions and 0 deletions
|
@ -689,6 +689,10 @@ main(void)
|
||||||
argument = args[i];
|
argument = args[i];
|
||||||
char *res = argument.func(argument.args);
|
char *res = argument.func(argument.args);
|
||||||
char *element = smprintf(argument.format, res);
|
char *element = smprintf(argument.format, res);
|
||||||
|
if (element == NULL) {
|
||||||
|
element = smprintf("n/a");
|
||||||
|
fprintf(stderr, "Failed to format output.");
|
||||||
|
}
|
||||||
strcat(status_string, element);
|
strcat(status_string, element);
|
||||||
free(res);
|
free(res);
|
||||||
free(element);
|
free(element);
|
||||||
|
|
Loading…
Reference in a new issue