Hi!

On Tue, 29 Apr 2025 21:01, Collin Funk said:
> (has_only_base64): Use memchr since calling strchr on a non-NUL
> terminated string is undefined behavior.

Very good catch.  I was my fault 22 years ago:

> -static char bintoasc[64] =
> +static char bintoasc[64] ATTR_NONSTRING =
>         "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
>         "abcdefghijklmnopqrstuvwxyz"
>         "0123456789+/";

That is actually similar code as in g10/armor.c; which however uses
bintoasc[] and thus let the compiler determine the array size.  I can
only speculate that I used the 64 byte array because the inverse
asctobin array has a fixed size on purpose.

Thanks for the patch.  I am going to apply this to all branches.

Regarding the nonstring attribute we need to wait that we can make
libgpg-error 1.55 a requirement.  That version provides the
GPGRT_ATTR_NONSTRING.  For master we might soon make this a dependency
but not for the other branches.


Shalom-Salam,

   Werner


-- 
The pioneers of a warless world are the youth that
refuse military service.             - A. Einstein

Attachment: openpgp-digital-signature.asc
Description: PGP signature

_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-devel

Reply via email to