loader: r362262 did miss the pathlen check

While we are checking the "/dev/" prefix, we can skip the paths shorter than
this prefix.

Sponsored by:	Netflix, Klara Inc.
This commit is contained in:
tsoome 2020-06-17 10:56:58 +00:00
parent 5c16d0080a
commit f0e4094102

View File

@ -1201,7 +1201,7 @@ vdev_init(uint64_t guid, const unsigned char *nvlist, vdev_t **vdevp)
char prefix[] = "/dev/"; char prefix[] = "/dev/";
len = strlen(prefix); len = strlen(prefix);
if (memcmp(path, prefix, len) == 0) { if (len < pathlen && memcmp(path, prefix, len) == 0) {
path += len; path += len;
pathlen -= len; pathlen -= len;
} }