EVP: allow empty strings to EVP_Decode* functions
authorRichard Levitte <levitte@openssl.org>
Sat, 13 Jun 2020 20:16:14 +0000 (22:16 +0200)
committerPauli <paul.dale@oracle.com>
Mon, 15 Jun 2020 22:23:25 +0000 (08:23 +1000)
This is a simple check order correction.

Fixes #12143

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12144)

crypto/evp/encode.c

index fb657d1..01552ac 100644 (file)
@@ -423,7 +423,7 @@ static int evp_decodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t,
         table = data_ascii2bin;
 
     /* trim white space from the start of the line. */
-    while ((conv_ascii2bin(*f, table) == B64_WS) && (n > 0)) {
+    while ((n > 0) && (conv_ascii2bin(*f, table) == B64_WS)) {
         f++;
         n--;
     }