git: 759bd6630be1 - stable/12 - loader: r362262 did miss the pathlen check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Oct 2021 06:10:51 UTC
The branch stable/12 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=759bd6630be149492871ef851b7f10921fab2cf2
commit 759bd6630be149492871ef851b7f10921fab2cf2
Author: Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2020-06-17 10:56:58 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 02:42:59 +0000
loader: r362262 did miss the pathlen check
While we are checking the "/dev/" prefix, we can skip the paths shorter than
this prefix.
(cherry picked from commit aba2397e74a2eff55e2507c27ba31813d6b2a95e)
---
stand/libsa/zfs/zfsimpl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c
index 276c4d8bc70b..b6a906e9f50d 100644
--- a/stand/libsa/zfs/zfsimpl.c
+++ b/stand/libsa/zfs/zfsimpl.c
@@ -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;
}