gbproxy: Fix segfault for VTY delete-gbproxy-link

Currently the code segfaults when the link shall be deleted by IMSI
when the IMSI has not been set yet.

This patch adds a NULL check to skip the entry before calling
gsm48_mi_to_string,

Adresses:
Program received signal SIGSEGV, Segmentation fault.
0xb693af77 in gsm48_mi_to_string (string=0xbfffe020 "", str_len=200,
mi=0x0, mi_len=0) at gsm48.c:360
    360         mi_type = mi[0] & GSM_MI_TYPE_MASK;
    str_len=200, mi=0x0, mi_len=0) at gsm48.c:360
    self=0x807c9a0 <delete_gb_link_by_id_cmd>, vty=0xb4303c70,
     argc=3, argv=0xbfffe1c0) at gb_proxy_vty.c:670
...

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2014-10-20 17:22:36 +02:00 committed by Holger Hans Peter Freyther
parent 4c70e719e3
commit ce4c8888c2
1 changed files with 2 additions and 0 deletions

View File

@ -666,6 +666,8 @@ DEFUN(delete_gb_link_by_id, delete_gb_link_by_id_cmd,
continue;
break;
case MATCH_IMSI:
if (!link_info->imsi)
continue;
mi_buf[0] = '\0';
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
link_info->imsi,