From 15246b6eafcf72d323a26d72f8b34d9b4a597f69 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 6 Jul 2026 18:06:12 +0200 Subject: [PATCH] Prevent integer wrap-around when checking string length in sgetbs --- cmdline/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdline/stream.c b/cmdline/stream.c index e4b8b40d..aa382107 100644 --- a/cmdline/stream.c +++ b/cmdline/stream.c @@ -679,7 +679,7 @@ int sgetbs(STREAM* f, char* str, size_t size) /* LCOV_EXCL_STOP */ } - if (len + 1 > size) { + if (len >= size) { /* LCOV_EXCL_START */ return -1; /* LCOV_EXCL_STOP */