CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/12/04 13:44:49
Modified files:
lib/libcrypto/asn1: tasn_utl.c
Log message:
libcrypto: avoid buffer overwrite due to truncating long to int
The cached DER encoding has a length stored as a long but the i2d API
uses an int. Since i2d has this two-step Muppet API where the first
call reports back an int to allow the caller to allocate a buffer and
then have i2d write to it, this can go wrong when LONG_MAX > INT_MAX:
the caller allocates the truncated int size reported back and passes
that in and the API then writes out the long-sized buffer containing
the cached DER, writing past the end.
This requires lots of memory to be an actual issue.
Fix adapted from OpenSSL 8257d58a by Cygnus Qu with a few tweaks by me.
ok jsing kenjiro