intf_line.c: Make e1d_find_intf_by_usb_serial safe for empty string
Avoid segfault in case the empty string is passed as serial_str. Change-Id: Ia69912cb714441415d8decd68890d1b97b77132d
This commit is contained in:
parent
591249a3c2
commit
2819d3fb79
|
@ -100,6 +100,9 @@ e1d_find_intf_by_usb_serial(struct e1_daemon *e1d, const char *serial_str)
|
||||||
{
|
{
|
||||||
struct e1_intf *intf;
|
struct e1_intf *intf;
|
||||||
|
|
||||||
|
if (!serial_str)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
llist_for_each_entry(intf, &e1d->interfaces, list)
|
llist_for_each_entry(intf, &e1d->interfaces, list)
|
||||||
if (intf->usb.serial_str && !strcmp(intf->usb.serial_str, serial_str))
|
if (intf->usb.serial_str && !strcmp(intf->usb.serial_str, serial_str))
|
||||||
return intf;
|
return intf;
|
||||||
|
|
Loading…
Reference in New Issue