From 4b43b375b7abae22070cd86bfc26a8222233150e Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 31 Jan 2024 13:24:56 -0500 Subject: check for overlapping pointers --- src/stdio/fputs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/stdio/fputs.c') diff --git a/src/stdio/fputs.c b/src/stdio/fputs.c index a82338d1..c4d32dec 100644 --- a/src/stdio/fputs.c +++ b/src/stdio/fputs.c @@ -1,4 +1,5 @@ #include +#include #include "_stdio.h" /** write a string to a file stream **/ @@ -6,6 +7,8 @@ int fputs(const char * restrict s, FILE * restrict stream) { SIGNAL_SAFE(0); + ASSERT_NOOVERLAP(s, strlen(s), stream, sizeof(*stream)); + flockfile(stream); while (*s) { if (fputc(*s++, stream) == EOF) { -- cgit v1.2.1