Skip to content

Commit 4243f5c

Browse files
committed
Make the length argument to print_unknown_data() unsigned.
All data lengths should be unsigned.
1 parent 228f225 commit 4243f5c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

netdissect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ extern u_int ppp_print(netdissect_options *, const u_char *, u_int);
662662
extern u_int pppoe_print(netdissect_options *, const u_char *, u_int);
663663
extern void pptp_print(netdissect_options *, const u_char *);
664664
extern void ptp_print(netdissect_options *, const u_char *, u_int);
665-
extern int print_unknown_data(netdissect_options *, const u_char *, const char *, int);
665+
extern int print_unknown_data(netdissect_options *, const u_char *, const char *, u_int);
666666
extern const char *q922_string(netdissect_options *, const u_char *, u_int);
667667
extern void q933_print(netdissect_options *, const u_char *, u_int);
668668
extern void radius_print(netdissect_options *, const u_char *, u_int);

util-print.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -473,17 +473,13 @@ void nd_print_invalid(netdissect_options *ndo)
473473
*/
474474

475475
int
476-
print_unknown_data(netdissect_options *ndo, const u_char *cp,const char *ident,int len)
476+
print_unknown_data(netdissect_options *ndo, const u_char *cp,
477+
const char *ident, u_int len)
477478
{
478479
u_int len_to_print;
479480

480-
if (len < 0) {
481-
ND_PRINT("%sDissector error: print_unknown_data called with negative length",
482-
ident);
483-
return(0);
484-
}
485481
len_to_print = len;
486-
if (ndo->ndo_snapend < cp) {
482+
if (!ND_TTEST_LEN(cp, 0)) {
487483
ND_PRINT("%sDissector error: print_unknown_data called with pointer past end of packet",
488484
ident);
489485
return(0);

0 commit comments

Comments
 (0)