fixed strcat null possibility in main()
Aaron Marcher info@nulltime.net
Mon, 15 Aug 2016 13:08:34 +0200
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
slstatus.c
→
slstatus.c
@@ -689,6 +689,10 @@ for (size_t i = 0; i < sizeof(args) / sizeof(args[0]); ++i) {
argument = args[i]; char *res = argument.func(argument.args); char *element = smprintf(argument.format, res); + if (element == NULL) { + element = smprintf("n/a"); + fprintf(stderr, "Failed to format output."); + } strcat(status_string, element); free(res); free(element);