Permalink
Browse files

crash: packet_id_debug_print: sl may be null

Program received signal SIGSEGV, Segmentation fault.
packet_id_debug_print (msglevel=1174405255, p=0xa36bd0718,
pin=0x3de5feec1b0,
message=0xa330dde80 "PID_TEST", value=0) at
../../../src/openvpn/packet_id.c:504
504       for (i = 0; i < sl->x_size; ++i)

(gdb) print sl
$2 = (const struct seq_list *) 0x0

Reported in the past[1].

[1] http://thread.gmane.org/gmane.network.openvpn.devel/5466

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: James Yonan <james@openvpn.net>
Message-Id: 1333879485-2417-1-git-send-email-alon.barlev@gmail.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6259
Message-Id: 4F9A6B4B.7060502@openvpn.net
URL: http://article.gmane.org/gmane.network.openvpn.devel/6350
Signed-off-by: David Sommerseth <davids@redhat.com>
  • Loading branch information...
1 parent bff413d commit 4e846b39a35b5f9501e4283be0af620d7c9c8b5c @alonbl alonbl committed with David Sommerseth Apr 8, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 src/openvpn/packet_id.c
@@ -501,7 +501,7 @@ packet_id_debug_print (int msglevel,
buf_printf (&out, "%s [%d]", message, value);
buf_printf (&out, " [%s-%d] [", p->name, p->unit);
- for (i = 0; i < sl->x_size; ++i)
+ for (i = 0; sl != NULL && i < sl->x_size; ++i)
{
char c;
time_t v;
@@ -538,11 +538,15 @@ packet_id_debug_print (int msglevel,
p->time_backtrack,
p->max_backtrack_stat,
(int)p->initialized);
- buf_printf (&out, " sl=[%d,%d,%d,%d]",
- sl->x_head,
- sl->x_size,
- sl->x_cap,
- sl->x_sizeof);
+ if (sl != NULL)
+ {
+ buf_printf (&out, " sl=[%d,%d,%d,%d]",
+ sl->x_head,
+ sl->x_size,
+ sl->x_cap,
+ sl->x_sizeof);
+ }
+
msg (msglevel, "%s", BSTR(&out));
gc_free (&gc);

0 comments on commit 4e846b3

Please sign in to comment.