]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
x509asn1: fix operator order in do_pubkey
authorDaniel Stenberg <daniel@haxx.se>
Thu, 7 May 2026 21:35:40 +0000 (23:35 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 8 May 2026 08:27:25 +0000 (10:27 +0200)
Check the range before reading data, as it would otherwise read one byte
too many.

Reported-by: Andrew Nesbit
Closes #21533

lib/vtls/x509asn1.c

index 788dfb278ade403544d30d601c797364541d058f..2ab74cadf6d5229db2d615802dc9535b671dbbc2 100644 (file)
@@ -1013,7 +1013,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum, const char *algo,
       return 1;
 
     /* Compute key length. */
-    for(q = elem.beg; !*q && q < elem.end; q++)
+    for(q = elem.beg; q < elem.end && !*q; q++)
       ;
     len = ((elem.end - q) * 8);
     if(len) {