From 3c5a1439458b3e0275a7a6be224ef55bd7ad2d68 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Wed, 30 Apr 2025 10:36:18 +0200 Subject: Fix access to the bintoasc mapping in the libksba support. * common/ksba-io-support.c (has_only_base64): Use memchr since calling strchr on a non-NUL terminated string is undefined behavior. -- Signed-off-by: Collin Funk This patch has been stripped from Colin's original patch because this is not just about a warning but an actual bug. That bug was introduced in 2003 by me. - wk --- common/ksba-io-support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/ksba-io-support.c') diff --git a/common/ksba-io-support.c b/common/ksba-io-support.c index 352485ffa..ff5e49531 100644 --- a/common/ksba-io-support.c +++ b/common/ksba-io-support.c @@ -174,7 +174,7 @@ has_only_base64 (const unsigned char *line, int linelen) { if (*line == '\n' || (linelen > 1 && *line == '\r' && line[1] == '\n')) break; - if ( !strchr (bintoasc, *line) ) + if ( !memchr (bintoasc, *line, sizeof (bintoasc)) ) return 0; } return 1; /* yes */ -- cgit v1.2.3