[Bug 4075] CryptoPkg: RsaGetPrivateKeyFromPem() crashed in Libfuzzer test



--- Comment #2 from yi1.li@... <yi1.li@...> ---
The root cause is the inappropriate implementation of BIO_snprintf():
For the crashed case, RsaGetPrivateKeyFromPem() will:
1)malloc a piece of memory S,

2)and use BIO_snprintf() to print a NULL-terminated string to S,

3)finally call strlen(S) to get length.

Due to BIO_snprintf() does nothing but just return a good status 0, program
will consider this string to be written successfully, then strlen() will

There are two solution choice:
1. Add true implementation to OpensslLib, but this will increase the
8kb DXE driver binary size.
2. Fake BIO_snprintf() need to return error status -1.

You are receiving this mail because:
You are on the CC list for the bug.