The branch main has been updated by imp:

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

commit bfa36136a56cdcec73ee5771c4c0a117469ff020
Author:     Aryan Arora <[email protected]>
AuthorDate: 2026-08-07 13:37:17 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2026-09-01 13:54:12 +0000

    kboot: Fix file2str() buffer under-read
    
    Signed-off-by: Aryan Arora <[email protected]>
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/2359
---
 stand/kboot/libkboot/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/kboot/libkboot/util.c b/stand/kboot/libkboot/util.c
index c7fe8b542643..f1902710612a 100644
--- a/stand/kboot/libkboot/util.c
+++ b/stand/kboot/libkboot/util.c
@@ -26,7 +26,7 @@ file2str(const char *fn, char *buffer, size_t buflen)
        /*
         * Trim trailing white space
         */
-       while (isspace(buffer[len - 1]))
+       while (len > 0 && isspace(buffer[len - 1]))
                buffer[--len] = '\0';
        host_close(fd);
        return true;

Reply via email to