In case /sys/devices/virtual/ubi/ubi?/ubi?_?/name doesn't exist volname
will be NULL and calling strlen for NULL isn't a good idea.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
/* todo: skip existing gluebi device for legacy support */
volname = read_string_from_file(voldir, "name");
+ if (!volname) {
+ fprintf(stderr, "Couldn't read %s/name\n", voldir);
+ return -1;
+ }
if (strncmp(name, volname, strlen(volname) + 1))
return -1;