]> git.ipfire.org Git - thirdparty/iproute2.git/commit
color: handle case where fmt is NULL
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 23 Jan 2024 04:26:08 +0000 (20:26 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 23 Jan 2024 04:26:08 +0000 (20:26 -0800)
commitda5a2d94dc012a923133e94bed25a67f6bd74657
treecf1b75bb9c7825a695979da8f905a6383761f7fb
parent325c96e749436fc8305e7a67a6f1e54e37045450
color: handle case where fmt is NULL

There are cases where NULL is passed as format string when
nothing is to be printed. This is commonly done in the print_bool
function when a flag is false. Glibc seems to handle this case nicely
but for musl it will cause a segmentation fault

Since nothing needs to be printed, in this case; just check
for NULL and return.

Reported-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/color.c