@@ -245,8 +245,7 @@ ntp_time_print(netdissect_options *ndo,
245
245
uint8_t stratum ;
246
246
u_int efs_len ;
247
247
248
- if (length < NTP_TIMEMSG_MINLEN )
249
- goto invalid ;
248
+ ND_ICHECK_U (length , < , NTP_TIMEMSG_MINLEN );
250
249
251
250
stratum = GET_U_1 (bp -> stratum );
252
251
ND_PRINT (", Stratum %u (%s)" ,
@@ -369,8 +368,7 @@ ntp_control_print(netdissect_options *ndo,
369
368
uint8_t control , R , E , M , opcode ;
370
369
uint16_t sequence , status , assoc , offset , count ;
371
370
372
- if (length < NTP_CTRLMSG_MINLEN )
373
- goto invalid ;
371
+ ND_ICHECK_U (length , < , NTP_CTRLMSG_MINLEN );
374
372
375
373
control = GET_U_1 (cd -> control );
376
374
R = (control & 0x80 ) != 0 ;
@@ -396,8 +394,7 @@ ntp_control_print(netdissect_options *ndo,
396
394
count = GET_BE_U_2 (cd -> count );
397
395
ND_PRINT (", Count=%hu" , count );
398
396
399
- if (NTP_CTRLMSG_MINLEN + count > length )
400
- goto invalid ;
397
+ ND_ICHECK_U (length , < , NTP_CTRLMSG_MINLEN + count );
401
398
if (count != 0 ) {
402
399
ND_TCHECK_LEN (cd -> data , count );
403
400
ND_PRINT ("\n\tTO-BE-DONE: data not interpreted" );
0 commit comments