]> The Tcpdump Group git mirrors - tcpdump/commitdiff
RESP: Remove some redundant checks.
authorGuy Harris <[email protected]>
Wed, 15 Feb 2017 21:22:41 +0000 (13:22 -0800)
committerDenis Ovsienko <[email protected]>
Wed, 13 Sep 2017 11:25:44 +0000 (12:25 +0100)
Before we break out of the loop, we've already checked for those
conditions.  No need to check for them again.

This fixes Coverity CIDs 1400553 and 1400554.

print-resp.c

index dee22d63a2fd1fbf323bac06a3dad7b0c097a99b..bec8b6da237ee9c856c64ab7d99acc427d9be56f 100644 (file)
@@ -503,15 +503,11 @@ resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, con
         len--;
         saw_digit = 1;
     }
-    if (!saw_digit)
-        goto invalid;
 
     /*
-     * OK, the next thing should be \r\n.
+     * OK, we found a non-digit character.  It should be a \r, followed
+     * by a \n.
      */
-    if (len == 0)
-        goto trunc;
-    ND_TCHECK(*bp);
     if (*bp != '\r') {
         bp++;
         goto invalid;