[PATCH] bug in urltrans.c

"Dariusz Markowicz" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <01f801c2c87c$cfde56b0$1900000a@toster>
Hi list,

This patch solves smsbox crash problem in urltrans_get_pattern() (urltrans.c).
Not every SMSC (i.e. CIMD2 and OISD) return additional text message
in DLR. So, when this text is NULL smsbox will crash.

Best regards,
Dariusz Markowicz
urltrans.diff (application/octet-stream, 894 B)
--- gateway/gw/urltrans.c	Thu Sep  5 14:00:59 2002
+++ gateway-custom/gw/urltrans.c	Sun Jan 26 18:28:37 2003
@@ -305,16 +305,20 @@
     if (request->sms.sms_type != report && t->type == TRANSTYPE_SENDSMS)
         return octstr_create("");
 
-    word_list = octstr_split_words(request->sms.msgdata);
-    num_words = list_len(word_list);
-
+    if (request->sms.msgdata) {
+        word_list = octstr_split_words(request->sms.msgdata);
+        num_words = list_len(word_list);
+    } else {
+    	word_list = list_create();
+    	num_words = 0;
+    }
+		
     result = octstr_create("");
 
     /* check if this is a delivery report message or not */
     if (request->sms.sms_type != report) {
         pattern = t->pattern;
     } else {
-
         /* this is a DLR message */
         reply = octstr_duplicate(request->sms.msgdata);
         url = octstr_duplicate(request->sms.dlr_url);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.