From: Nikos Mavrogiannopoulos Date: Sat, 15 Jul 2017 16:52:33 +0000 (+0200) Subject: parse_pem_cert_mem: fixed issue resulting to accessing past the input data X-Git-Tag: gnutls_3_6_0~322 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7bc8c6eea0f0fc9d02cfd22fe9fea364061ee37;p=thirdparty%2Fgnutls.git parse_pem_cert_mem: fixed issue resulting to accessing past the input data Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/lib/x509.c b/lib/x509.c index af231441bf..3e64fb14a8 100644 --- a/lib/x509.c +++ b/lib/x509.c @@ -590,9 +590,10 @@ parse_pem_cert_mem(gnutls_certificate_credentials_t res, /* now we move ptr after the pem header */ ptr++; + size--; + /* find the next certificate (if any) */ - size = input_cert_size - (ptr - input_cert); if (size > 0) { char *ptr3; @@ -605,6 +606,7 @@ parse_pem_cert_mem(gnutls_certificate_credentials_t res, sizeof(PEM_CERT_SEP2) - 1); ptr = ptr3; + size = input_cert_size - (ptr - input_cert); } else ptr = NULL;