Use for loop in WPACKET_fill_lengths instead of do...while
authorMatt Caswell <matt@openssl.org>
Fri, 27 Jan 2017 12:05:52 +0000 (12:05 +0000)
committerMatt Caswell <matt@openssl.org>
Mon, 30 Jan 2017 10:18:24 +0000 (10:18 +0000)
Based on review feedback

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2259)

ssl/packet.c

index 87473fb..3479f1f 100644 (file)
@@ -232,12 +232,10 @@ int WPACKET_fill_lengths(WPACKET *pkt)
     if (pkt->subs == NULL)
         return 0;
 
-    sub = pkt->subs;
-    do {
+    for (sub = pkt->subs; sub != NULL; sub = sub->parent) {
         if (!wpacket_intern_close(pkt, sub, 0))
             return 0;
-        sub = sub->parent;
-    } while (sub != NULL);
+    }
 
     return 1;
 }