[openssl/openssl] cdcc9a: BIO_vprintf: fix off-by-one at 512-byte buffer bou...

"'Mounir IDRASSI' via openssl-commits" <[email protected]> Wed, 08 Jul 2026 04:30:37 -0700
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/openssl-4.0/[email protected]>
  Branch: refs/heads/openssl-4.0
  Home:   https://github.com/openssl/openssl
  Commit: cdcc9a6e4007d9bfe88cac01ed41fae12803c2ee
      https://github.com/openssl/openssl/commit/cdcc9a6e4007d9bfe88cac01ed41fae12803c2ee
  Author: Mounir IDRASSI <[email protected]>
  Date:   2026-07-08 (Wed, 08 Jul 2026)

  Changed paths:
    M crypto/bio/bio_print.c
    M test/bio_core_test.c

  Log Message:
  -----------
  BIO_vprintf: fix off-by-one at 512-byte buffer boundary

BIO_vprintf() first formats into a 512-byte stack buffer. Since
vsnprintf() returns the required length excluding the NUL, a return
value of 512 means truncation. The old strict greater-than check
therefore wrote the truncated buffer for exactly 512-byte output.

Use >= for the realloc path and add boundary coverage for 511-, 512-
and 513-byte outputs.

Fixes: a29d157fdb6d "Replace homebrewed implementation of *printf*() functions with libc"

Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Eugene Syromiatnikov <[email protected]>
MergeDate: Wed Jul  8 11:24:31 2026
(Merged from https://github.com/openssl/openssl/pull/31842)

(cherry picked from commit f2924392d32968f550afc0051c1108b1d553d6e1)



To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications

-- 
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/openssl-4.0/a9860f-cdcc9a%40github.com.