From 48d186f3d06220cabbff80d6107528b94dcc9d38 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Tue, 27 Feb 2018 15:33:55 -0800 Subject: [PATCH] fastboot: Check validity of dev_path In some occations dev_path is not valid and we therefor can't dereference it. Check for this and ignore any events without a dev_path. Signed-off-by: Bjorn Andersson --- fastboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastboot.c b/fastboot.c index 6dcf397..c11fe5a 100644 --- a/fastboot.c +++ b/fastboot.c @@ -240,7 +240,7 @@ static int handle_udev_event(int fd, void *data) // pid = udev_device_get_sysattr_value(dev, "idProduct"); serial = udev_device_get_sysattr_value(dev, "serial"); - if (!action) + if (!action || !dev_path) goto unref_dev; if (!strcmp(action, "add")) {