Skip to content

Commit 0137749

Browse files
committed
FR: Avoid reinventing nd_printjnp()
1 parent fd8442f commit 0137749

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

print-fr.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ u_int
441441
mfr_print(netdissect_options *ndo,
442442
const u_char *p, u_int length)
443443
{
444-
u_int tlen,idx,hdr_len = 0;
444+
u_int tlen,hdr_len = 0;
445445
uint16_t sequence_num;
446446
uint8_t ie_type,ie_len;
447447
const uint8_t *tptr;
@@ -515,12 +515,7 @@ mfr_print(netdissect_options *ndo,
515515

516516
case MFR_CTRL_IE_BUNDLE_ID: /* same message format */
517517
case MFR_CTRL_IE_LINK_ID:
518-
for (idx = 0; idx < ie_len && idx < MFR_ID_STRING_MAXLEN; idx++) {
519-
if (GET_U_1(tptr + idx) != 0) /* don't print null termination */
520-
fn_print_char(ndo, GET_U_1(tptr + idx));
521-
else
522-
break;
523-
}
518+
nd_printjnp(ndo, tptr, ND_MIN(ie_len, MFR_ID_STRING_MAXLEN));
524519
break;
525520

526521
case MFR_CTRL_IE_TIMESTAMP:

0 commit comments

Comments
 (0)