[PATCH] trivial fix smpp-pdu

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Centrium GmbH
Message-ID <[email protected]>
Hi List,

attached you can find patch that should fix (my mistake:() parsing of optional 
parameters in smpp stack ...

-- 
Best Regards / Mit besten Grüßen aus Köln

Dipl.-Ing.
Alexander Malysh
___________________________________

Centrium GmbH
Ehrenstrasse 2
50672 Köln

Fon: +49 (0221) 277 49 240
Fax: +49 (0221) 277 49 109

email: [email protected]
web: http://www.centrium.de
msn: [email protected]
smpp_pdu_more_robust-1.diff (text/x-diff, 2.6 KB)
Index: gw/smsc/smpp_pdu.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smpp_pdu.c,v
retrieving revision 1.9
diff -a -u -r1.9 smpp_pdu.c
--- gw/smsc/smpp_pdu.c	28 Jan 2003 23:56:13 -0000	1.9
+++ gw/smsc/smpp_pdu.c	12 Mar 2003 13:16:23 -0000
@@ -225,7 +225,7 @@
                 opt_tag = decode_integer(data_without_len, pos, 2); pos += 2;           \
                 debug("sms.smpp", 0, "Optional parameter tag (0x%04lx)", opt_tag);      \
                 opt_len = decode_integer(data_without_len, pos, 2); pos += 2;           \
-                debug("smpp_pdu", 0, "Optional parameter length read as %ld", opt_len);
+                debug("sms.smpp", 0, "Optional parameter length read as %ld", opt_len);
     #define TLV(tag_id, min_len, max_len)                                                                          \
                 if (tag_id == opt_tag) {                                                                           \
                     if ((min_len != -1 && opt_len < min_len) || (max_len != -1 && opt_len > max_len) ||            \
@@ -240,14 +240,13 @@
                     dict_put(p->optional_parameters, tag_str, opt_val);                                            \
                     octstr_destroy(tag_str);                                                                       \
                     opt_val = NULL;                                                                                \
-                }
-    #define OPTIONAL_END                                                                \
-    		if (opt_val != NULL) {                                                             \
-		    error(0, "SMPP: Uknown optional parameter (%ld) for PDU type (%ld) received!", \
+                } else 
+    #define OPTIONAL_END                                                                           \
+    		{                                                             \
+		    error(0, "SMPP: Uknown optional parameter (0x%04lx) for PDU type (%ld) received!", \
 		            opt_tag, type);                                                        \
-                octstr_destroy(opt_val);                                                \
 		}                                                                                  \
-            }                                                                           \
+            }                                                                                      \
         } 
     #define INTEGER(name, octets) \
     	p->name = decode_integer(data_without_len, pos, octets); \
smime.p7s (application/pkcs7-signature, 2.5 KB) - not displayed
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.