Retire the Windows BIO_printf workaround.

With the UCRT, introduced in VS 2015, vsnprintf in MSVC is now
C99-conformant. See:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=msvc-170

It is a little unclear to me whether "Beginning with the UCRT in Visual
Studio 2015 and Windows 10" means it is only C99-conformant in Windows
10, or if this is referring to how the UCRT starts becoming an OS
component in Windows 10. I think the latter. This document talks about
the UCRT:
https://docs.microsoft.com/en-us/cpp/porting/upgrade-your-code-to-the-universal-crt?view=msvc-170

But we have tests which cover this in BIOTest.Printf. If it's not
C99-compliant in Windows 7, we'll notice in Chromium's CI.

Change-Id: I932ec2633f94bd77dbe797b06a6bfbc95a568335
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52086
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
fips-20220613
David Benjamin 3 years ago committed by Boringssl LUCI CQ
parent 4984e4a632
commit c9a7dd6879
  1. 12
      crypto/bio/printf.c

@ -71,18 +71,6 @@ int BIO_printf(BIO *bio, const char *format, ...) {
va_start(args, format);
out_len = vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
#if defined(OPENSSL_WINDOWS)
// On Windows, vsnprintf returns -1 rather than the requested length on
// truncation
if (out_len < 0) {
va_start(args, format);
out_len = _vscprintf(format, args);
va_end(args);
assert(out_len >= (int)sizeof(buf));
}
#endif
if (out_len < 0) {
return -1;
}

Loading…
Cancel
Save