]> The Tcpdump Group git mirrors - tcpdump/commitdiff
squelch a signedness compiler warning on FreeBSD
authorDenis Ovsienko <[email protected]>
Fri, 30 Sep 2016 22:10:01 +0000 (23:10 +0100)
committerDenis Ovsienko <[email protected]>
Fri, 30 Sep 2016 22:10:01 +0000 (23:10 +0100)
Rearrange the variables to compare two pointers instead of two integers.

./signature.c:145:40: warning: comparison of integers of different signs: 'int' and 'u_int' (aka 'unsigned int') [-Wsign-compare]

$ cc --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd10.2
Thread model: posix

signature.c

index c97b853421e1c8f4fd2bab1d96ed0b225b42c807..d9811a0be8cd632bb49228ca7f88bdf1e4aa45f3 100644 (file)
@@ -142,7 +142,7 @@ signature_verify(netdissect_options *ndo, const u_char *pptr, u_int plen,
         /* No. */
         return (CANT_CHECK_SIGNATURE);
     }
-    if ((sig_ptr + sizeof(sig) - pptr) > plen) {
+    if (sig_ptr + sizeof(sig) > pptr + plen) {
         /* No. */
         return (CANT_CHECK_SIGNATURE);
     }