commit | b73ce45b3f87672f5dfcc4e136ae8e9771c5552d | [log] [tgz] |
---|---|---|
author | Manuel Pégourié-Gonnard <mpg2@elzevir.fr> | Mon Sep 28 18:27:15 2015 +0200 |
committer | Manuel Pégourié-Gonnard <mpg2@elzevir.fr> | Thu Oct 01 17:00:22 2015 +0200 |
tree | 9727781ce362445bb25b5167f1a6f0a26cc5ef33 | |
parent | 9b75305d6a77383ddcacea46106aac55513d4a9e [diff] [blame] |
Fix potential random malloc in pem_read()
diff --git a/library/pem.c b/library/pem.c index 5c973ac..81098ee 100644 --- a/library/pem.c +++ b/library/pem.c
@@ -287,6 +287,9 @@ #endif /* POLARSSL_MD5_C && (POLARSSL_AES_C || POLARSSL_DES_C) */ } + if( s1 == s2 ) + return( POLARSSL_ERR_PEM_INVALID_DATA ); + len = 0; ret = base64_decode( NULL, &len, s1, s2 - s1 );