diff options
Diffstat (limited to 'src/string')
| -rw-r--r-- | src/string/memcmp.c | 1 | ||||
| -rw-r--r-- | src/string/memmove_s.c | 1 | ||||
| -rw-r--r-- | src/string/strcmp.c | 1 | ||||
| -rw-r--r-- | src/string/strcoll.c | 1 | ||||
| -rw-r--r-- | src/string/strcspn.c | 1 | ||||
| -rw-r--r-- | src/string/strncat_s.c | 2 | ||||
| -rw-r--r-- | src/string/strncmp.c | 1 | ||||
| -rw-r--r-- | src/string/strpbrk.c | 1 | ||||
| -rw-r--r-- | src/string/strspn.c | 1 | ||||
| -rw-r--r-- | src/string/strstr.c | 1 | ||||
| -rw-r--r-- | src/string/strtok.c | 1 | ||||
| -rw-r--r-- | src/string/strtok_s.c | 2 | ||||
| -rw-r--r-- | src/string/strxfrm.c | 1 |
13 files changed, 14 insertions, 1 deletions
diff --git a/src/string/memcmp.c b/src/string/memcmp.c index 028d2354..f87f849a 100644 --- a/src/string/memcmp.c +++ b/src/string/memcmp.c @@ -12,6 +12,7 @@ int memcmp(const void *s1, const void *s2, size_t n) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modifications, so overlap is OK */ for (i = 0; i < n; i++) { if (p[i] != q[i]) { diff --git a/src/string/memmove_s.c b/src/string/memmove_s.c index 0475ee00..a6d84b55 100644 --- a/src/string/memmove_s.c +++ b/src/string/memmove_s.c @@ -8,6 +8,7 @@ errno_t memmove_s(void *s1, rsize_t s1max, const void *s2, rsize_t n) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* Overlap is explicitly allowed */ if (n > s1max) { /* do the right thing */ diff --git a/src/string/strcmp.c b/src/string/strcmp.c index 8c679f4b..58102d79 100644 --- a/src/string/strcmp.c +++ b/src/string/strcmp.c @@ -8,6 +8,7 @@ int strcmp(const char *s1, const char *s2) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modifcation, overlap is OK */ while (*s1 && *s2) { if (*s1 != *s2) { diff --git a/src/string/strcoll.c b/src/string/strcoll.c index aab2f1f5..8ad9361e 100644 --- a/src/string/strcoll.c +++ b/src/string/strcoll.c @@ -13,6 +13,7 @@ int strcoll(const char *s1, const char *s2) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modification, overlap is OK */ x1 = malloc(strxfrm(x1, s1, 0)); x2 = malloc(strxfrm(x2, s2, 0)); diff --git a/src/string/strcspn.c b/src/string/strcspn.c index 19f83fda..f2e8c588 100644 --- a/src/string/strcspn.c +++ b/src/string/strcspn.c @@ -10,6 +10,7 @@ size_t strcspn(const char *s1, const char *s2) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modification, overlap is OK */ for (i = 0; s1[i] != '\0'; i++) { if (strchr (s2, s1[i]) != NULL) { diff --git a/src/string/strncat_s.c b/src/string/strncat_s.c index 700e8fb7..99b3f0ad 100644 --- a/src/string/strncat_s.c +++ b/src/string/strncat_s.c @@ -7,7 +7,7 @@ errno_t strncat_s(char * restrict s1, rsize_t s1max, const char * restrict s2, r SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); - (void)s1max; //ASSERT_NOOVERLAP(s1, s1max, s2, strlen(s1) + strlen(s2)); + ASSERT_NOOVERLAP(s1, s1max, s2, n); char *append = s1 + strlen(s1); for (size_t i = 0; i < n; i++) { diff --git a/src/string/strncmp.c b/src/string/strncmp.c index bea831b3..627f9c47 100644 --- a/src/string/strncmp.c +++ b/src/string/strncmp.c @@ -8,6 +8,7 @@ int strncmp(const char *s1, const char *s2, size_t n) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modifcation, overlap is OK */ if (strlen(s1) < n) { n = strlen(s1); diff --git a/src/string/strpbrk.c b/src/string/strpbrk.c index 714c282a..7225ac4c 100644 --- a/src/string/strpbrk.c +++ b/src/string/strpbrk.c @@ -10,6 +10,7 @@ char * strpbrk(const char *s1, const char *s2) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modifcation, overlap is OK */ for (i = 0; i < strlen (s1); i++) { if (strchr(s2, s1[i]) != NULL) { diff --git a/src/string/strspn.c b/src/string/strspn.c index 156abe06..82e0dc9c 100644 --- a/src/string/strspn.c +++ b/src/string/strspn.c @@ -10,6 +10,7 @@ size_t strspn(const char *s1, const char *s2) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modification, overlap is OK */ for (i = 0; i < strlen (s1); i++) { if (strchr(s2, s1[i]) == NULL) { diff --git a/src/string/strstr.c b/src/string/strstr.c index fa5db853..eac8ea77 100644 --- a/src/string/strstr.c +++ b/src/string/strstr.c @@ -12,6 +12,7 @@ char * strstr(const char *s1, const char *s2) SIGNAL_SAFE(0); ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); + /* no modifcation, overlap is OK */ l1 = strlen(s1); l2 = strlen(s2); diff --git a/src/string/strtok.c b/src/string/strtok.c index 69b7fcc8..c46a9556 100644 --- a/src/string/strtok.c +++ b/src/string/strtok.c @@ -11,6 +11,7 @@ char * strtok(char * restrict s1, const char * restrict s2) /* TODO */ SIGNAL_SAFE(0); ASSERT_NONNULL(s2); + /* nothing is copied, overlap is OK */ /* RETURN(CONSTANT(NULL), there are no further tokens, only token separators); diff --git a/src/string/strtok_s.c b/src/string/strtok_s.c index 859e4885..867029c6 100644 --- a/src/string/strtok_s.c +++ b/src/string/strtok_s.c @@ -4,6 +4,8 @@ char * strtok_s(char * restrict s1, rsize_t * restrict s1max, const char * restrict s2, char **restrict ptr) { SIGNAL_SAFE(0); + /* TODO: check for overlap */ + /* what is the limit a pointer? */ (void)s1; (void)s1max; (void)s2; (void)ptr; return NULL; } diff --git a/src/string/strxfrm.c b/src/string/strxfrm.c index fc16087a..9d0b5429 100644 --- a/src/string/strxfrm.c +++ b/src/string/strxfrm.c @@ -9,6 +9,7 @@ size_t strxfrm(char * restrict s1, const char * restrict s2, size_t n) (void)s1; (void)s2; (void)n; SIGNAL_SAFE(0); ASSERT_NONNULL(s2); + ASSERT_NOOVERLAP(s1, n, s2, n); if (n != 0) { ASSERT_NONNULL(s1); |
