From: kay.sievers@vrfy.org Date: Tue, 30 Dec 2003 09:07:59 +0000 (-0800) Subject: [PATCH] fix for apply_format() X-Git-Tag: 012~21 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=647c8fc43eb8f3d92ed7142f7c235f3db02f4cfa;p=systemd [PATCH] fix for apply_format() fix possible NULL pointer in '%c' callout substitution and cleanup '%D' debug text --- diff --git a/namedev.c b/namedev.c index 949c2eed..e69eba65 100644 --- a/namedev.c +++ b/namedev.c @@ -200,11 +200,12 @@ static void apply_format(struct udevice *udev, unsigned char *string) case 'D': if (strlen(udev->kernel_number) == 0) { strcat(pos, "disc"); + dbg("substitute devfs disc"); break; } strcat(pos, "part"); strcat(pos, udev->kernel_number); - dbg("substitute kernel number '%s'", udev->kernel_number); + dbg("substitute devfs part '%s'", udev->kernel_number); break; case 'm': sprintf(pos, "%u", udev->minor); @@ -229,8 +230,10 @@ static void apply_format(struct udevice *udev, unsigned char *string) break; } } - strcat(pos, pos3); - dbg("substitute partial callout output '%s'", pos3); + if (pos3) { + strcat(pos, pos3); + dbg("substitute partial callout output '%s'", pos3); + } } else { strcat(pos, udev->callout_value); dbg("substitute callout output '%s'", udev->callout_value);