Skip to content

Commit 85c7815

Browse files
committed
SOME/IP: Replace the remaining "goto invalid" check with ND_ICHECK_U()
Rename variable 'len' to 'length' for ND_ICHECK_U() printing. Define SOMEIP_HDR_LEN.
1 parent 35b6bdf commit 85c7815

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

print-someip.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4040
*/
4141

42+
#define SOMEIP_HDR_LEN 16
43+
4244
static const struct tok message_type_values[] = {
4345
{ 0x00, "REQUEST" },
4446
{ 0x01, "REQUEST_NO_RETURN" },
@@ -74,7 +76,7 @@ static const struct tok return_code_values[] = {
7476
};
7577

7678
void
77-
someip_print(netdissect_options *ndo, const u_char *bp, const u_int len)
79+
someip_print(netdissect_options *ndo, const u_char *bp, const u_int length)
7880
{
7981
uint32_t message_id;
8082
uint16_t service_id;
@@ -92,9 +94,7 @@ someip_print(netdissect_options *ndo, const u_char *bp, const u_int len)
9294
ndo->ndo_protocol = "someip";
9395
nd_print_protocol_caps(ndo);
9496

95-
if (len < 16) {
96-
goto invalid;
97-
}
97+
ND_ICHECK_U(length, <, SOMEIP_HDR_LEN);
9898

9999
message_id = GET_BE_U_4(bp);
100100
service_id = message_id >> 16;

0 commit comments

Comments
 (0)