summaryrefslogtreecommitdiff
path: root/src/string/strdup.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-06-11 13:44:21 -0400
committerJakob Kaivo <jkk@ung.org>2024-06-11 13:44:21 -0400
commit4f29706128f3d3a66f0503d07c4960d4021aaf27 (patch)
tree7f76ae1b7819b99756feb1daf93cfe31d5c41c3b /src/string/strdup.c
parent523944d96e11bde68bf9bcf8e42b7ebc99c5ed3d (diff)
support watching for dangerous parameter accessnon-posix
Diffstat (limited to 'src/string/strdup.c')
-rw-r--r--src/string/strdup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/string/strdup.c b/src/string/strdup.c
index 9780deaa..0016a267 100644
--- a/src/string/strdup.c
+++ b/src/string/strdup.c
@@ -5,7 +5,10 @@
char *strdup(const char *s)
{
ASSERT_NONNULL(s);
+ DANGEROUS_READ(s, -1);
size_t len = strlen(s) + 1;
+ DANGER_OVER();
+
char *dup = malloc(len);
memcpy(dup, s, len);
return dup;