mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
Add sanity check to print_bin function
Add a sanity check to the print_bin function to ensure that the |off| argument is positive. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org>
This commit is contained in:
parent
cb0f400b0c
commit
3deeeeb61b
@ -345,12 +345,14 @@ static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
|
||||
|
||||
if (buf == NULL)
|
||||
return 1;
|
||||
if (off) {
|
||||
if (off > 0) {
|
||||
if (off > 128)
|
||||
off = 128;
|
||||
memset(str, ' ', off);
|
||||
if (BIO_write(fp, str, off) <= 0)
|
||||
return 0;
|
||||
} else {
|
||||
off = 0;
|
||||
}
|
||||
|
||||
if (BIO_printf(fp, "%s", name) <= 0)
|
||||
|
Loading…
Reference in New Issue
Block a user