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:
Harald Welte 2022-03-28 10:11:05 +02:00
parent 591249a3c2
commit 2819d3fb79
1 changed files with 3 additions and 0 deletions

View File

@ -100,6 +100,9 @@ e1d_find_intf_by_usb_serial(struct e1_daemon *e1d, const char *serial_str)
{
struct e1_intf *intf;
if (!serial_str)
return NULL;
llist_for_each_entry(intf, &e1d->interfaces, list)
if (intf->usb.serial_str && !strcmp(intf->usb.serial_str, serial_str))
return intf;