]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix off-by-one error in print-rx.c
authorDenis Ovsienko <[email protected]>
Fri, 19 Apr 2013 17:38:11 +0000 (21:38 +0400)
committerDenis Ovsienko <[email protected]>
Fri, 19 Apr 2013 17:40:52 +0000 (21:40 +0400)
Avoid dereferencing rx_cache[RX_CACHE_SIZE], which is one past the last
valid element.

(This fixes SF bug 3599633 / GH bug 287. I could not identify the name
or email address of the original contributor. -- Denis)

print-rx.c

index 70393ea5cbbe2c290971d012a349d81f74edde1d..383ef3713ffc17aea18a701e572910a01b145c05 100644 (file)
@@ -653,7 +653,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
                        *opcode = rxent->opcode;
                        return(1);
                }
-               if (++i > RX_CACHE_SIZE)
+               if (++i >= RX_CACHE_SIZE)
                        i = 0;
        } while (i != rx_cache_hint);