diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/bp-checks.h | 5 | ||||
-rw-r--r-- | sysdeps/generic/strcpy.c | 12 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sysdeps/generic/bp-checks.h b/sysdeps/generic/bp-checks.h index a7c54b4955..ea71cf875f 100644 --- a/sysdeps/generic/bp-checks.h +++ b/sysdeps/generic/bp-checks.h @@ -68,6 +68,9 @@ extern int __ubp_memchr (const char *__unbounded, int, unsigned); && BOUNDS_VIOLATED), \ __ptrvalue (ARG)) +# define CHECK_SIGSET(SET) CHECK_N ((SET), _NSIG / (8 * sizeof *(SET))) +# define CHECK_SIGSETopt(SET) CHECK_Nopt ((SET), _NSIG / (8 * sizeof *(SET))) + # else /* !__BOUNDED_POINTERS__ */ /* Do nothing if not compiling with -fbounded-pointers. */ @@ -80,6 +83,8 @@ extern int __ubp_memchr (const char *__unbounded, int, unsigned); # define CHECK_N(ARG, N) (ARG) # define CHECK_Nopt(ARG, N) (ARG) # define CHECK_STRING(ARG) (ARG) +# define CHECK_SIGSET(SET) (SET) +# define CHECK_SIGSETopt(SET) (SET) # endif /* !__BOUNDED_POINTERS__ */ diff --git a/sysdeps/generic/strcpy.c b/sysdeps/generic/strcpy.c index cb260cf85a..2317eba65c 100644 --- a/sysdeps/generic/strcpy.c +++ b/sysdeps/generic/strcpy.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #include <stddef.h> #include <string.h> #include <memcopy.h> +#include <bp-checks.h> #undef strcpy @@ -29,8 +30,9 @@ strcpy (dest, src) const char *src; { reg_char c; - char *s = (char *) src; - const ptrdiff_t off = dest - src - 1; + char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src); + const ptrdiff_t off = CHECK_BOUNDS_LOW (dest) - s - 1; + size_t n; do { @@ -39,5 +41,9 @@ strcpy (dest, src) } while (c != '\0'); + n = s - src; + CHECK_BOUNDS_HIGH (src + n); + CHECK_BOUNDS_HIGH (dest + n); + return dest; } |