Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 2021 06:10:51 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 759bd6630be1 - stable/12 - loader: r362262 did miss the pathlen check
Message-ID:  <202110080610.1986ApYv007276@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110080610.1986ApYv007276>