summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-07-15 18:52:33 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-17 15:45:48 +0200
commit1cd38f58e74adf98a51c1a4d2c19e25fa0c0b7f9 (patch)
treec5c6206225ba4ed20c391dfdc5345215f59d4dc6
parentcf0f4f92acc9695a7f02472c0f2868fdc46483a2 (diff)
downloadgnutls-1cd38f58e74adf98a51c1a4d2c19e25fa0c0b7f9.tar.gz
parse_pem_cert_mem: fixed issue resulting to accessing past the input data
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--lib/x509.c4
1 files changed, 3 insertions, 1 deletions
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;