apps/rehash.c: avoid printf format warning [-Wformat]
authorMatthias St. Pierre <matthias.st.pierre@ncp-e.com>
Wed, 25 Oct 2023 09:05:58 +0000 (11:05 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 8 Nov 2023 09:28:22 +0000 (10:28 +0100)
commitec0d22fe1571508c08b714715cfdb6ac60c53f78
tree5608011e9ec50037028d058a03b4c47e3c93bd05
parent7cf75e5caa71a54539d4559c3fb6b0a48b92243f
apps/rehash.c: avoid printf format warning [-Wformat]

The `aarch64-linux-android33-clang` cross-compiler (v14.0.6)
complains twice about an unsupported '%n' format specifier,
preventing a successful `--strict-warnings` build:

    error: '%n' specifier not supported on this platform [-Werror,-Wformat]
                BIO_snprintf(buf, buflen, "%s%s%n%08x.%s%d",

This is a false positive, because BIO_snprintf() implements its
own format parsing (which is implemented in the _dopr() function).

This commit fixes the problem by rewriting the code to dispense with
the dubious '%n' format specifier. As a side-effect, the code becomes
a little bit more comprehensible and self-explaining.

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22511)
apps/rehash.c