RE: [PATCH] SMPP panic when sender or receiver address longerthen20 characters.
"Oded Arbel" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
> -----Original Message----- > From: Harrie Hazewinkel [mailto:[email protected]] > > I admit these .def files are difficult, but I believe we need to make > a define and use that define +1 in the .def file to allcate the space > and use the define itself in the other places. K - how about like this ? -- Oded Arbel m-Wise mobile solutions [email protected] +972-9-9581711 (116) +972-67-340014 ::.. I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it. -- Deep Thoughts by Jack Handy
smsc_smpp.patch
(application/octet-stream, 2 KB)
--- gateway/gw/smsc/smsc_smpp.c 2002-08-08 20:44:38.000000000 +0300
+++ gateway/gw/smsc/smsc_smpp.c 2002-08-11 16:09:55.000000000 +0300
@@ -264,8 +270,8 @@
pdu = smpp_pdu_create(submit_sm,
counter_increase(smpp->message_id_counter));
- pdu->u.submit_sm.source_addr = octstr_duplicate(msg->sms.sender);
- pdu->u.submit_sm.destination_addr = octstr_duplicate(msg->sms.receiver);
+ pdu->u.submit_sm.source_addr = octstr_copy(msg->sms.sender,0,SMPP_MAX_ADDR_LEN);
+ pdu->u.submit_sm.destination_addr = octstr_copy(msg->sms.receiver,0,SMPP_MAX_ADDR_LEN);
/* Check for manual override of source ton and npi values */
if(smpp->source_addr_ton > -1 && smpp->source_addr_npi > -1) {
--- gateway/gw/smsc/smpp_pdu.h 2002-08-09 13:55:47.000000000 +0300
+++ gateway/gw/smsc/smpp_pdu.h 2002-08-11 16:08:43.000000000 +0300
@@ -11,6 +11,8 @@
#include "gwlib/gwlib.h"
+#define SMPP_MAX_ADDR_LEN 20
+
enum {
#define INTEGER(name, octets)
--- gateway/gw/smsc/smpp_pdu.def 2002-08-09 13:55:47.000000000 +0300
+++ gateway/gw/smsc/smpp_pdu.def 2002-08-11 16:09:30.000000000 +0300
@@ -117,10 +117,10 @@
NULTERMINATED(service_type, 6)
INTEGER(source_addr_ton, 1)
INTEGER(source_addr_npi, 1)
- NULTERMINATED(source_addr, 21)
+ NULTERMINATED(source_addr, (SMPP_MAX_ADDR_LEN+1))
INTEGER(dest_addr_ton, 1)
INTEGER(dest_addr_npi, 1)
- NULTERMINATED(destination_addr, 21)
+ NULTERMINATED(destination_addr, (SMPP_MAX_ADDR_LEN+1))
INTEGER(esm_class, 1)
INTEGER(protocol_id, 1)
INTEGER(priority_flag, 1)
@@ -146,10 +146,10 @@
NULTERMINATED(service_type, 6)
INTEGER(source_addr_ton, 1)
INTEGER(source_addr_npi, 1)
- NULTERMINATED(source_addr, 21)
+ NULTERMINATED(source_addr, (SMPP_MAX_ADDR_LEN+1))
INTEGER(dest_addr_ton, 1)
INTEGER(dest_addr_npi, 1)
- NULTERMINATED(destination_addr, 21)
+ NULTERMINATED(destination_addr, (SMPP_MAX_ADDR_LEN+1))
INTEGER(esm_class, 1)
INTEGER(protocol_id, 1)
INTEGER(priority_flag, 1)