Skip to content

Commit

Permalink
Address a compiler error on illumos.
Browse files Browse the repository at this point in the history
Apparently, in this context UINT_MAX happens to be defined on all OSes
currently in CI except illumos (both GCC and Clang):

gcc (OmniOS 151044/12.2.0-il-0) 12.2.0:
print-snmp.c:543:48: error: 'UINT_MAX' undeclared (first use in this
  function)
print-snmp.c:276:1: note: 'UINT_MAX' is defined in header '<limits.h>';
  did you forget to '#include <limits.h>'?

Instead of including <limits.h> (which indeed would define the constant)
match the variable type by using UINT32_MAX, which happens to be defined
already.
  • Loading branch information
infrastation committed Oct 22, 2022
1 parent 7cf1f48 commit 4b675b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion print-snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ asn1_parse(netdissect_options *ndo,
goto invalid;
}
if (GET_U_1(p) & ASN_BIT8) /* negative */
data = UINT_MAX;
data = UINT32_MAX;
for (i = elem->asnlen; i != 0; p++, i--)
data = (data << ASN_SHIFT8) | GET_U_1(p);
elem->data.integer = data;
Expand Down

0 comments on commit 4b675b2

Please sign in to comment.