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 8add1ea48f
commit bad5d68c7a

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