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:
Toomas Soome 2020-06-17 10:56:58 +00:00
parent b6aadd183a
commit aba2397e74

View File

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