From 6a1d428f5692de5281e287fd6bf430dba4ae84d5 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 20 Oct 2014 17:22:36 +0200 Subject: 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 , vty=0xb4303c70, argc=3, argv=0xbfffe1c0) at gb_proxy_vty.c:670 ... Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gb_proxy_vty.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'openbsc/src/gprs') diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c index 8a7523c4e..3042cf570 100644 --- a/openbsc/src/gprs/gb_proxy_vty.c +++ b/openbsc/src/gprs/gb_proxy_vty.c @@ -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, -- cgit v1.2.3