aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-10-25 05:14:19 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-10-25 15:11:00 +0000
commit82b2776e314f91a0b0b503bade9720cbb47d87a9 (patch)
treee0fe2b0374998f2660c82d4bfb23b0925fd41176
parent0c0383df88836b5e072f63c3b3a8f5f6b24c094b (diff)
vnet/tcp/tcp.c: address a corner case.
Avoid possible null pointer dereference Change-Id: If8023edb43aaf037234f4a7b5f191cb23b09c74d Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r--src/vnet/tcp/tcp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 122e1208ce5..5fadef08038 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1803,12 +1803,15 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose)
scoreboard_init (&dummy_tc->sack_sb);
dummy_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK;
-#if TCP_SCOREBOARD_TRACE
+/* Since this is also accessible via decl. in tcp.h.
+ * Otherwise, it is gated earlier by cli parser.
+ */
+#if (!TCP_SCOREBOARD_TRACE)
+ s = format (0, "scoreboard tracing not enabled");
+ return s;
+#else
trace = tc->sack_sb.trace;
trace_len = vec_len (tc->sack_sb.trace);
-#else
- trace = 0;
- trace_len = 0;
#endif
for (i = 0; i < trace_len; i++)