summaryrefslogtreecommitdiff
path: root/src/inttypes
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 13:24:56 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 13:24:56 -0500
commit4b43b375b7abae22070cd86bfc26a8222233150e (patch)
tree6ff165b17879e80300cb6d05b5537a65c82c2dc7 /src/inttypes
parentab3c589cd14c2b7efd79c89fd75ea35edcf9edff (diff)
check for overlapping pointers
Diffstat (limited to 'src/inttypes')
-rw-r--r--src/inttypes/strtoimax.c2
-rw-r--r--src/inttypes/strtoumax.c2
-rw-r--r--src/inttypes/wcstoimax.c1
-rw-r--r--src/inttypes/wcstoumax.c1
4 files changed, 6 insertions, 0 deletions
diff --git a/src/inttypes/strtoimax.c b/src/inttypes/strtoimax.c
index 2185f293..01a8bfdb 100644
--- a/src/inttypes/strtoimax.c
+++ b/src/inttypes/strtoimax.c
@@ -2,11 +2,13 @@
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
+#include <string.h>
#include "_safety.h"
intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base)
{
SIGNAL_SAFE(0);
+ ASSERT_NOOVERLAP(nptr, strlen(nptr), endptr, sizeof(*endptr));
intmax_t ret = 0;
intmax_t max = INTMAX_MAX;
diff --git a/src/inttypes/strtoumax.c b/src/inttypes/strtoumax.c
index 2889f109..77ae2f10 100644
--- a/src/inttypes/strtoumax.c
+++ b/src/inttypes/strtoumax.c
@@ -2,11 +2,13 @@
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
+#include <string.h>
#include "_safety.h"
uintmax_t strtoumax(const char *restrict nptr, char ** restrict endptr, int base)
{
SIGNAL_SAFE(0);
+ ASSERT_NOOVERLAP(nptr, strlen(nptr), endptr, sizeof(*endptr));
uintmax_t ret = 0;
uintmax_t max = UINTMAX_MAX;
diff --git a/src/inttypes/wcstoimax.c b/src/inttypes/wcstoimax.c
index d49bf663..b75e61ca 100644
--- a/src/inttypes/wcstoimax.c
+++ b/src/inttypes/wcstoimax.c
@@ -9,6 +9,7 @@
intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
SIGNAL_SAFE(0);
+ ASSERT_NOOVERLAP(nptr, wcslen(nptr), endptr, sizeof(*endptr));
intmax_t ret = 0;
intmax_t max = INTMAX_MAX;
diff --git a/src/inttypes/wcstoumax.c b/src/inttypes/wcstoumax.c
index de1f1058..59788f90 100644
--- a/src/inttypes/wcstoumax.c
+++ b/src/inttypes/wcstoumax.c
@@ -9,6 +9,7 @@
uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base)
{
SIGNAL_SAFE(0);
+ ASSERT_NOOVERLAP(nptr, wcslen(nptr), endptr, sizeof(*endptr));
uintmax_t ret = 0;
uintmax_t max = UINTMAX_MAX;