Commit d891c48 for zlib
commit d891c4857feadb6ca9e32df72e72e8244926e1a6
Author: feiiiiii5 <feiiiiii5@users.noreply.github.com>
Date: Sat Sep 26 08:54:54 2026 +0800
Fix gzgets() to honor the zlib.h promise to return an empty string.
diff --git a/gzread.c b/gzread.c
index 814e38d..2785c6c 100644
--- a/gzread.c
+++ b/gzread.c
@@ -671,7 +671,7 @@ char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
/* append a terminating zero to the string (we don't check for a zero in
the contents, let the user worry about that) -- return the terminated
string, or if nothing was read, NULL */
- if (buf == str)
+ if (buf == str && len > 1)
return NULL;
buf[0] = 0;
return str;