Check return value of udev_device_get_syspath() to avoid
passing NULL parameter in rindex() function.
This solves bug reported by SVACE with WGID 540346.
Change-Id: Ic795e66c7b220ab1c5ced33901c86befb1e6f7db
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
if (extended_internal && !udev_device_get_property_value(dev, "ID_FS_TYPE")) {
char syspath[128] = {0};
+ const char *path;
char *r;
- r = rindex(udev_device_get_syspath(dev), '/');
+ path = udev_device_get_syspath(dev);
+ if (!path)
+ return -ENODEV;
+
+ r = rindex(path, '/');
if (!r) return -ENODEV;
snprintf(syspath, sizeof(syspath), "/sys/block%s", r);