Re: [PATCH] BUG in gw/wapbox.c:dispatch_datagram

David White <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Whoops.

A tiny little screwup made the patch included in the quoted message
unusable.

Attached is another try.

Thanks!

Dave WHITE
ONE GmbH

On Fri, 2003-10-24 at 15:27, David White wrote:
> Good Hello!
> 
> We've identified a bug in the STABLE version (1.2.1) involving the PPG.
> When messages with length 140-[0-6] arrive at dispatch_datagram in
> wapbox.c, the length of the existing udhdata (UDH port addressing IE) is
> not counted with the length of the msgdata (the WSP Push PDU).
> 
> This results in malformed Push OTA messages being sent out.
> 
> Our results with the one-line patch needed to fix this in 1.2.1 have
> been satisfactory.
> 
> This bug is fixed in CVS HEAD by hard-wiring the maximum number of
> messages to 10. The enclosed patch reverts to a corrected version of the
> old logic to calculate the number of SMs needed for Push OTA.
> 
> David WHITE
> ONE GmbH
> 
>
wapbox-dispatch_datagram.patch (text/x-patch, 1.2 KB)
Index: gw/wapbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/wapbox.c,v
retrieving revision 1.169
diff -u -r1.169 wapbox.c
--- gw/wapbox.c	7 Oct 2003 22:58:42 -0000	1.169
+++ gw/wapbox.c	24 Oct 2003 13:42:05 -0000
@@ -359,6 +359,8 @@
         *part;
     List *sms_datagrams;
     static unsigned long msg_sequence = 0L;   /* Used only by this function */
+    long max_msgs,
+	 msg_len;
 
     msg = part = NULL;
 
@@ -375,8 +377,10 @@
         } else {
             msg_sequence = counter_increase(sequence_counter) & 0xff;
             msg = pack_sms_datagram(dgram);
+            msg_len = octstr_len(msg->sms.msgdata) + octstr_len(msg->sms.udhdata);
+            max_msgs = (msg_len / MAX_SMS_OCTETS) + 1;
             sms_datagrams = sms_split(msg, NULL, NULL, NULL, NULL, concatenation, 
-                                      msg_sequence, max_messages, MAX_SMS_OCTETS);
+                                      msg_sequence, max_msgs, MAX_SMS_OCTETS);
             debug("wap",0,"WDP (wapbox): delivering %ld segments to bearerbox",
                   list_len(sms_datagrams));
             while ((part = list_extract_first(sms_datagrams)) != NULL) {
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.