glibc strftime.c bug: storing past the end of a zero-sized buffer
Paul Eggert
eggert@twinsun.com
Thu Sep 24 13:48:00 GMT 1998
While fixing the other bugs, I noticed by code inspection that glibc's
strftime (BUFFER, 0, "", ...) stores a byte into BUFFER, even though
the buffer's declared size is zero. Here is a patch.
1998-09-24 Paul Eggert <eggert@twinsun.com>
* strftime.c (my_strftime): Don't store past the end of a
zero-sized buffer.
--- strftime.c 1998/09/24 20:39:19 2.0.96.3
+++ strftime.c 1998/09/24 20:46:02 2.0.96.4
@@ -450,4 +450,7 @@ my_strftime (s, maxsize, format, tp)
const char *f;
+ if (maxsize == 0)
+ return 0;
+
zone = NULL;
#if HAVE_TM_ZONE
More information about the Libc-alpha
mailing list