]> The Tcpdump Group git mirrors - tcpdump/commitdiff
pflog: check against UINT_MAX, not UID_MAX.
authorGuy Harris <[email protected]>
Mon, 9 Sep 2024 07:47:28 +0000 (00:47 -0700)
committerGuy Harris <[email protected]>
Mon, 9 Sep 2024 07:47:28 +0000 (00:47 -0700)
We want a value that's not OS-dependent and that's defined.

print-pflog.c

index e23421c6e916e0f6205ea4baf62e9621127bd586..7cf2c37c629a42c954c9cec82d3cb8457541e68b 100644 (file)
@@ -247,7 +247,11 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr)
 
        ND_PRINT("%s", tok2str(pf_reasons, "unkn(%u)", GET_U_1(hdr->reason)));
 
-       if (GET_BE_U_4(hdr->uid) != UID_MAX)
+       /*
+        * All bits set means that the UID shouldn't be printed.
+        * That's UINT_MAX if signed, or -1 if unsigned.
+        */
+       if (GET_BE_U_4(hdr->uid) != UINT_MAX)
                ND_PRINT(" [uid %u]", GET_BE_U_4(hdr->uid));
 
 #if defined(__FreeBSD__)