[PATCH] SMPP null terminated input

"Simon Beale" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Null terminated messages received by kannel keep hold of the null and turn
it into an '@'. This is best demonstrated if you do a get-url with an input
null terminated message.

e.g.

received: HelloWorld\0

resulting URL requested: http://foo.bar/page.html?text=HelloWorld@

The attached patch chops off the trailing null if it's present (according to
the SMPP specification, the passed message doesn't have to be null
terminated).

Simon
null-term-msg.diff (application/octet-stream, 721 B)
Index: gw/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc_smpp.c,v
retrieving revision 1.56
diff -u -r1.56 smsc_smpp.c
--- gw/smsc_smpp.c	24 Apr 2002 08:13:36 -0000	1.56
+++ gw/smsc_smpp.c	24 Apr 2002 17:10:37 -0000
@@ -198,6 +198,9 @@
     pdu->u.deliver_sm.destination_addr = NULL;
     msg->sms.msgdata = pdu->u.deliver_sm.short_message;
     pdu->u.deliver_sm.short_message = NULL;
+    if (octstr_len(msg->sms.msgdata)>1)
+        if (octstr_get_char(msg->sms.msgdata,octstr_len(msg->sms.msgdata)-1)==0)
+            octstr_truncate(msg->sms.msgdata,octstr_len(msg->sms.msgdata)-1);
     charset_gsm_to_latin1(msg->sms.msgdata);
 
     return msg;
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.