The branch stable/12 has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=759bd6630be149492871ef851b7f10921fab2cf2

commit 759bd6630be149492871ef851b7f10921fab2cf2
Author:     Toomas Soome <[email protected]>
AuthorDate: 2020-06-17 10:56:58 +0000
Commit:     Kyle Evans <[email protected]>
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;
                }

Reply via email to