[openssl/openssl] 9fbdc3: apps/rehash.c: avoid printf format warning [-Wformat]

Matthias St. Pierre noreply at github.com
Wed Nov 8 09:31:14 UTC 2023


  Branch: refs/heads/openssl-3.1
  Home:   https://github.com/openssl/openssl
  Commit: 9fbdc367e468de11d010ee2aa2c6f934d372b600
      https://github.com/openssl/openssl/commit/9fbdc367e468de11d010ee2aa2c6f934d372b600
  Author: Matthias St. Pierre <matthias.st.pierre at ncp-e.com>
  Date:   2023-11-08 (Wed, 08 Nov 2023)

  Changed paths:
    M apps/rehash.c

  Log Message:
  -----------
  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 at siemens.com>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22511)

(cherry picked from commit ec0d22fe1571508c08b714715cfdb6ac60c53f78)




More information about the openssl-commits mailing list