@@ -245,8 +245,7 @@ ntp_time_print(netdissect_options *ndo,
245245 uint8_t stratum ;
246246 u_int efs_len ;
247247
248- if (length < NTP_TIMEMSG_MINLEN )
249- goto invalid ;
248+ ND_ICHECK_U (length , < , NTP_TIMEMSG_MINLEN );
250249
251250 stratum = GET_U_1 (bp -> stratum );
252251 ND_PRINT (", Stratum %u (%s)" ,
@@ -369,8 +368,7 @@ ntp_control_print(netdissect_options *ndo,
369368 uint8_t control , R , E , M , opcode ;
370369 uint16_t sequence , status , assoc , offset , count ;
371370
372- if (length < NTP_CTRLMSG_MINLEN )
373- goto invalid ;
371+ ND_ICHECK_U (length , < , NTP_CTRLMSG_MINLEN );
374372
375373 control = GET_U_1 (cd -> control );
376374 R = (control & 0x80 ) != 0 ;
@@ -396,8 +394,7 @@ ntp_control_print(netdissect_options *ndo,
396394 count = GET_BE_U_2 (cd -> count );
397395 ND_PRINT (", Count=%hu" , count );
398396
399- if (NTP_CTRLMSG_MINLEN + count > length )
400- goto invalid ;
397+ ND_ICHECK_U (length , < , NTP_CTRLMSG_MINLEN + count );
401398 if (count != 0 ) {
402399 ND_TCHECK_LEN (cd -> data , count );
403400 ND_PRINT ("\n\tTO-BE-DONE: data not interpreted" );
0 commit comments