libefi: efipart_hdinfo_add_filepath should check strtol result

Use errno for error checking.
This commit is contained in:
Toomas Soome 2017-09-22 07:40:05 +00:00
parent abf054b4c6
commit f43a98e6c2

View File

@ -489,7 +489,14 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle)
return (0);
}
p++; /* skip the colon */
errno = 0;
unit = (int)strtol(p, NULL, 0);
if (errno != 0) {
printf("Bad unit number for partition \"%s\"\n", pathname);
free(pathname);
free(pd);
return (EUNIT);
}
/*
* We should have disk registered, if not, we are receiving