Print unknown_str in case of error func can return NULL in case of error, but no checking is done when printing, and unknown_str wasn't being used anywhere.
SiIky siiky@users.noreply.github.com
Sat, 17 Feb 2018 18:08:27 +0000
1 files changed,
3 insertions(+),
1 deletions(-)
jump to
M
slstatus.c
→
slstatus.c
@@ -87,8 +87,10 @@ clock_gettime(CLOCK_MONOTONIC, &start);
status[0] = '\0'; for (i = len = 0; i < LEN(args); i++) { + const char * res = args[i].func(args[i].args); + res = (res == NULL) ? unknown_str : res; len += snprintf(status + len, sizeof(status) - len, - args[i].fmt, args[i].func(args[i].args)); + args[i].fmt, res); if (len >= sizeof(status)) { status[sizeof(status) - 1] = '\0';