mirror of
https://github.com/openssl/openssl.git
synced 2025-02-23 14:42:15 +08:00
Fix range checks with -offset and -length in asn1parse
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5826)
This commit is contained in:
parent
18ada952d1
commit
16e1eea6a6
@ -258,14 +258,14 @@ int asn1parse_main(int argc, char **argv)
|
||||
num = tmplen;
|
||||
}
|
||||
|
||||
if (offset >= num) {
|
||||
if (offset < 0 || offset >= num) {
|
||||
BIO_printf(bio_err, "Error: offset too large\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
num -= offset;
|
||||
|
||||
if ((length == 0) || ((long)length > num))
|
||||
if (length == 0 || length > (unsigned int)num)
|
||||
length = (unsigned int)num;
|
||||
if (derout != NULL) {
|
||||
if (BIO_write(derout, str + offset, length) != (int)length) {
|
||||
|
Loading…
Reference in New Issue
Block a user