diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2023-05-01 09:10:17 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-05-01 11:21:18 -0700 |
commit | bdc715b1f7a4eee75214709d4a949bdf65bcc9a2 (patch) | |
tree | bbb4ecce636c2206ec8f923cee9700f82e91ec32 /lib | |
parent | a1d7a312646ec112140f4a3e112daac2194549df (diff) | |
download | gnulib-bdc715b1f7a4eee75214709d4a949bdf65bcc9a2.tar.gz |
regex: prefer C23 style overflow checking
* lib/regex_internal.h: Include stdckdint.h.
* lib/regexec.c (re_search_2_stub):
* modules/regex (Depends-on): Add stdckdint.
Prefer stdckdint.h to intprops.h macros.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/regex_internal.h | 1 | ||||
-rw-r--r-- | lib/regexec.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/regex_internal.h b/lib/regex_internal.h index ae9257eac0..0270091df7 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -29,6 +29,7 @@ #include <locale.h> #include <wchar.h> #include <wctype.h> +#include <stdckdint.h> #include <stdint.h> #ifndef _LIBC diff --git a/lib/regexec.c b/lib/regexec.c index 13e0349e72..f05f38ae0e 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -324,7 +324,7 @@ re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, char *s = NULL; if (__glibc_unlikely ((length1 < 0 || length2 < 0 || stop < 0 - || INT_ADD_WRAPV (length1, length2, &len)))) + || ckd_add (&len, length1, length2)))) return -2; /* Concatenate the strings. */ |