aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCollin Funk <[email protected]>2025-04-30 08:36:18 +0000
committerWerner Koch <[email protected]>2025-04-30 08:36:18 +0000
commit3c5a1439458b3e0275a7a6be224ef55bd7ad2d68 (patch)
tree009b9c8bb6778abe20754bfc4f42d5e4227ed880
parentgpg: New command --quick-tsign-key. (diff)
downloadgnupg-3c5a1439458b3e0275a7a6be224ef55bd7ad2d68.tar.gz
gnupg-3c5a1439458b3e0275a7a6be224ef55bd7ad2d68.zip
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 <[email protected]> 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
-rw-r--r--common/ksba-io-support.c2
1 files changed, 1 insertions, 1 deletions
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 */