Fix possible read access beyond the buffer.
* src/ber-help.c (_ksba_ber_parse_tl): Add extra sanity check. * src/cert.c (ksba_cert_get_cert_policies): Check TLV given length against buffer length. (ksba_cert_get_ext_key_usages): Ditto. * src/ocsp.c (parse_asntime_into_isotime): Ditto.
The returned length of the object from _ksba_ber_parse_tl (ti.length)
was not always checked against the actual buffer length, thus leading
to a read access after the end of the buffer and thus a segv.
- GnuPG-bug-id: T2344
- Reported-by: Pascal Cuoq
- Signed-off-by: Werner Koch <wk@gnupg.org>