diff options
author | Jakob Kaivo <jkk@ung.org> | 2024-06-11 13:44:21 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2024-06-11 13:44:21 -0400 |
commit | 4f29706128f3d3a66f0503d07c4960d4021aaf27 (patch) | |
tree | 7f76ae1b7819b99756feb1daf93cfe31d5c41c3b /src/string/strcpy.c | |
parent | 523944d96e11bde68bf9bcf8e42b7ebc99c5ed3d (diff) |
support watching for dangerous parameter accessnon-posix
Diffstat (limited to 'src/string/strcpy.c')
-rw-r--r-- | src/string/strcpy.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/string/strcpy.c b/src/string/strcpy.c index 620fdd1e..f13a102c 100644 --- a/src/string/strcpy.c +++ b/src/string/strcpy.c @@ -6,20 +6,22 @@ char * strcpy(char * restrict s1, const char * restrict s2) { char *p = s1; + size_t len = 0; SIGNAL_SAFE(0); + ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); - - DANGER(s2); - - ASSERT_NOOVERLAP(s1, strlen(s2), s2, strlen(s2)); + DANGEROUS_READ(s2, 0); + len = strlen(s2); + ASSERT_NOOVERLAP(s1, len, s2, len); + DANGEROUS_WRITE(s1, len); while ((*s1++ = *s2++) != '\0') { continue; } - DANGER(0); + DANGER_OVER(); /* RETURN_ALWAYS(ARGUMENT(s1)); |