From 647c8fc43eb8f3d92ed7142f7c235f3db02f4cfa Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:07:59 -0800 Subject: [PATCH] [PATCH] fix for apply_format() fix possible NULL pointer in '%c' callout substitution and cleanup '%D' debug text --- namedev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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); -- 2.39.5