]> The Tcpdump Group git mirrors - tcpdump/commitdiff
timed: Fix bounds check when printing Machine Name
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 19 May 2018 10:36:55 +0000 (12:36 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 19 May 2018 10:36:55 +0000 (12:36 +0200)
print-timed.c

index 7397ef8b3c61197a4595614a34f73b340cb20774..f9a5835a4d8c6cc60ddbef956bfe8ff570b7d884 100644 (file)
@@ -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;