]> err.no Git - systemd/commitdiff
[PATCH] fix for apply_format()
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Tue, 30 Dec 2003 09:07:59 +0000 (01:07 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:12 +0000 (21:13 -0700)
fix possible NULL pointer in '%c' callout substitution
and cleanup '%D' debug text

namedev.c

index 949c2eedf681c6cc34dad8d0037197add32ba1bc..e69eba657a5be161deda8eafdee9e79d238e86d3 100644 (file)
--- 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);