summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2003-12-30 01:07:59 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:12 -0700
commit647c8fc43eb8f3d92ed7142f7c235f3db02f4cfa (patch)
tree641a841df22951deb02a2a771b3015901b1f45c0 /namedev.c
parent0529e2ed2eb1ccfd28d2cd33ce759f9c7b9bc0ff (diff)
downloadsystemd-647c8fc43eb8f3d92ed7142f7c235f3db02f4cfa.tar.gz
[PATCH] fix for apply_format()
fix possible NULL pointer in '%c' callout substitution and cleanup '%D' debug text
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/namedev.c b/namedev.c
index 949c2eedf6..e69eba657a 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);