summaryrefslogtreecommitdiff
path: root/src/string/strncpy.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/strncpy.c
parent523944d96e11bde68bf9bcf8e42b7ebc99c5ed3d (diff)
support watching for dangerous parameter accessnon-posix
Diffstat (limited to 'src/string/strncpy.c')
-rw-r--r--src/string/strncpy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/string/strncpy.c b/src/string/strncpy.c
index 2b4c40d1..0dd18aab 100644
--- a/src/string/strncpy.c
+++ b/src/string/strncpy.c
@@ -11,6 +11,8 @@ char * strncpy(char * restrict s1, const char * restrict s2, size_t n)
ASSERT_NONNULL(s1);
ASSERT_NONNULL(s2);
ASSERT_NOOVERLAP(s1, n, s2, n);
+ DANGEROUS_READ(s2, n);
+ DANGEROUS_WRITE(s1, n);
for (i = 0; i < n; i++) {
s1[i] = s2[i];
@@ -20,6 +22,8 @@ char * strncpy(char * restrict s1, const char * restrict s2, size_t n)
}
}
+ DANGER_OVER();
+
return s1;
}