prevent segfault in case we hit an empty sequence
This commit is contained in:
parent
d4945ac521
commit
16f397d55c
@ -361,8 +361,11 @@ int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc
|
|||||||
/* len update */
|
/* len update */
|
||||||
totlen += data_offset;
|
totlen += data_offset;
|
||||||
|
|
||||||
/* link them up y0 */
|
/* the flexi decoder can also do nothing, so make sure a child has been allocated */
|
||||||
l->child->parent = l;
|
if (l->child) {
|
||||||
|
/* link them up y0 */
|
||||||
|
l->child->parent = l;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -398,12 +401,15 @@ int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc
|
|||||||
|
|
||||||
outside:
|
outside:
|
||||||
|
|
||||||
/* rewind l please */
|
/* in case we processed anything */
|
||||||
while (l->prev != NULL || l->parent != NULL) {
|
if (totlen) {
|
||||||
if (l->parent != NULL) {
|
/* rewind l please */
|
||||||
l = l->parent;
|
while (l->prev != NULL || l->parent != NULL) {
|
||||||
} else {
|
if (l->parent != NULL) {
|
||||||
l = l->prev;
|
l = l->parent;
|
||||||
|
} else {
|
||||||
|
l = l->prev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user