From 2b09fabe84f01d02efabd4a79a9e49213b78fc98 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 15 May 2008 03:48:58 +0000 Subject: [PATCH] Fix str[c]spn off by one error. Submitted-by: "Dionysus Blazakis" --- lib/libc/string/strcspn.c | 4 ++-- lib/libc/string/strspn.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/string/strcspn.c b/lib/libc/string/strcspn.c index 3c0052221f..db9cbf3725 100644 --- a/lib/libc/string/strcspn.c +++ b/lib/libc/string/strcspn.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/lib/libc/string/strcspn.c,v 1.4 2005/03/29 19:36:39 joerg Exp $ + * $DragonFly: src/lib/libc/string/strcspn.c,v 1.5 2008/05/15 03:48:58 dillon Exp $ */ #include @@ -46,7 +46,7 @@ size_t strcspn(const char *str, const char *chars) { const char *s; - bool charset[UCHAR_MAX]; + bool charset[UCHAR_MAX + 1]; _DIAGASSERT(str != NULL); _DIAGASSERT(chars != NULL); diff --git a/lib/libc/string/strspn.c b/lib/libc/string/strspn.c index eac35de004..0e20e9dace 100644 --- a/lib/libc/string/strspn.c +++ b/lib/libc/string/strspn.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/lib/libc/string/strspn.c,v 1.4 2005/03/31 13:17:22 joerg Exp $ + * $DragonFly: src/lib/libc/string/strspn.c,v 1.5 2008/05/15 03:48:58 dillon Exp $ */ #include @@ -46,7 +46,7 @@ size_t strspn(const char *str, const char *chars) { const char *s; - bool charset[UCHAR_MAX]; + bool charset[UCHAR_MAX + 1]; _DIAGASSERT(str != NULL); _DIAGASSERT(chars != NULL); -- 2.41.0