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/strrchr.c | |
parent | 523944d96e11bde68bf9bcf8e42b7ebc99c5ed3d (diff) |
support watching for dangerous parameter accessnon-posix
Diffstat (limited to 'src/string/strrchr.c')
-rw-r--r-- | src/string/strrchr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/string/strrchr.c b/src/string/strrchr.c index c7172590..738935c1 100644 --- a/src/string/strrchr.c +++ b/src/string/strrchr.c @@ -10,11 +10,14 @@ char * strrchr(const char *s, int c) SIGNAL_SAFE(0); ASSERT_NONNULL(s); + DANGEROUS_READ(s, -1); for (i = strlen(s) + 1; i >= 0; i--) { if (s[i] == (char)c) { + DANGER_OVER(); return (char*)s + i; } } + DANGER_OVER(); /* RETURN_SUCCESS(a pointer to the found character); |