From: Francois-Xavier Le Bail Date: Sat, 19 May 2018 10:36:55 +0000 (+0200) Subject: timed: Fix bounds check when printing Machine Name X-Git-Tag: tcpdump-4.99-bp~1174 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/6f2cd8cee6372b2d3f4783ce30a603b31839d31f?ds=sidebyside timed: Fix bounds check when printing Machine Name --- diff --git a/print-timed.c b/print-timed.c index 7397ef8b..f9a5835a 100644 --- a/print-timed.c +++ b/print-timed.c @@ -45,7 +45,7 @@ struct tsp { struct tsp_timeval tspu_time; nd_int8_t tspu_hopcnt; } tsp_u; - nd_byte tsp_name[256]; + nd_byte tsp_name[256]; /* null-terminated string up to 256 */ }; #define tsp_time tsp_u.tspu_time @@ -138,7 +138,8 @@ timed_print(netdissect_options *ndo, break; } ND_PRINT(" name "); - if (nd_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name))) + if (nd_printzp(ndo, tsp->tsp_name, sizeof(tsp->tsp_name), + ndo->ndo_snapend)) goto trunc; return;