Prevent integer wrap-around when checking string length in sgetbs

This commit is contained in:
Andrea Mazzoleni 2026-07-06 18:06:12 +02:00
parent 4f7bbf1b9b
commit 15246b6eaf

View file

@ -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 */