Avoid NULL pointer dereferences
Add back NULL pointer checks accidentally dropped in r364946. We need to append a NUL character when that happens.
This commit is contained in:
parent
17c219fd6f
commit
5eade881a8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364949
@ -5499,11 +5499,20 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
|
||||
udev->dv_flags = dev->flags;
|
||||
udev->dv_state = dev->state;
|
||||
sbuf_new(&sb, udev->dv_fields, sizeof(udev->dv_fields), SBUF_FIXEDLEN);
|
||||
if (dev->nameunit != NULL)
|
||||
sbuf_cat(&sb, dev->nameunit);
|
||||
else
|
||||
sbuf_putc(&sb, '\0');
|
||||
sbuf_putc(&sb, '\0');
|
||||
if (dev->desc != NULL)
|
||||
sbuf_cat(&sb, dev->desc);
|
||||
else
|
||||
sbuf_putc(&sb, '\0');
|
||||
sbuf_putc(&sb, '\0');
|
||||
if (dev->driver != NULL)
|
||||
sbuf_cat(&sb, dev->driver->name);
|
||||
else
|
||||
sbuf_putc(&sb, '\0');
|
||||
sbuf_cat(&sb, dev->driver != NULL ? dev->driver->name : '\0');
|
||||
sbuf_putc(&sb, '\0');
|
||||
bus_child_pnpinfo_sb(dev, &sb);
|
||||
sbuf_putc(&sb, '\0');
|
||||
|
Loading…
Reference in New Issue
Block a user