Fix format for the dst address in the STN trace 86/12386/2
authorMilan Lenco <milan.lenco@pantheon.tech>
Thu, 3 May 2018 15:31:46 +0000 (17:31 +0200)
committerNeale Ranns <nranns@cisco.com>
Fri, 4 May 2018 08:12:45 +0000 (08:12 +0000)
Output string 's' was not assigned the return value of format() for
the destination address, which, in case the underlying memory was moved
by the realloc, resulted in an invalid memory access by the subsequent
invocations of format().

Change-Id: I2b5dfd85db085c553ca5ec0b3257aeeb437c360a
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
src/plugins/stn/stn.c

index 2838c4b..9368e1c 100644 (file)
@@ -63,8 +63,8 @@ format_stn_ip46_punt_trace (u8 * s, va_list * args, u8 is_ipv4)
   stn_ip46_punt_trace_t *t = va_arg (*args, stn_ip46_punt_trace_t *);
   u32 indent = format_get_indent (s);
 
-  format (s, "dst_address: %U\n", format_ip46_address,
-         (ip46_address_t *)&t->kv.key, IP46_TYPE_ANY);
+  s = format (s, "dst_address: %U\n", format_ip46_address,
+         (ip46_address_t *)t->kv.key, IP46_TYPE_ANY);
 
   if (t->kv.value == ~(0L))
     {