summaryrefslogtreecommitdiff
path: root/src/stdio/fputs.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 13:24:56 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 13:24:56 -0500
commit4b43b375b7abae22070cd86bfc26a8222233150e (patch)
tree6ff165b17879e80300cb6d05b5537a65c82c2dc7 /src/stdio/fputs.c
parentab3c589cd14c2b7efd79c89fd75ea35edcf9edff (diff)
check for overlapping pointers
Diffstat (limited to 'src/stdio/fputs.c')
-rw-r--r--src/stdio/fputs.c3
1 files changed, 3 insertions, 0 deletions
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 <stdio.h>
+#include <string.h>
#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) {