1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-05-14 08:13:25 +02:00

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 <collin.funk1@gmail.com>

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
This commit is contained in:
Collin Funk 2025-04-30 10:36:18 +02:00 committed by Werner Koch
parent d90b290f97
commit 3c5a143945
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -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 */