Re: [PATCH] Hex Digits in submit_sm_resp and dlr

"Mi Reflejo" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Attached.

Martin

On 6/4/06, Alexander Malysh <[email protected]> wrote:
> Hi Martin,
>
> please use octstr_check_range(octstr, 0, octstr_len(octstr), gw_isdigit).
>
> Thanks,
> Alex
>
> Mi Reflejo wrote:
>
> > There is a patch for "detect" if the comming number for msg_id
> > containing only decimal digits, otherwise we deal with this as hex.
> >
> > According to
> > http://bugs.kannel.org/view_bug_advanced_page.php?f_id=0000334
> >
> > Regards,
> > Martin Conte.
>
> --
> Thanks,
> Alex
>
>
>
hex_detection_checkrange.patch (application/octet-stream, 1.2 KB)
--- gw/smsc/smsc_smpp.c.orig	2006-06-04 00:03:07.000000000 -0600
+++ gw/smsc/smsc_smpp.c	2006-06-04 10:26:14.000000000 -0600
@@ -1264,7 +1264,7 @@
             /* the default, C string */
             tmp = octstr_duplicate(msgid);
         } else {
-            if (smpp->smpp_msg_id_type & 0x02) {
+            if ((smpp->smpp_msg_id_type & 0x02) || (!octstr_check_range(msgid, 0, octstr_len(msgid), gw_isdigit))) {
                 tmp = octstr_format("%lu", strtoll(octstr_get_cstr(msgid), NULL, 16));
             } else {
                 tmp = octstr_format("%lu", strtoll(octstr_get_cstr(msgid), NULL, 10));
@@ -1480,7 +1480,8 @@
                     /* the default, C string */
                     tmp = octstr_duplicate(pdu->u.submit_sm_resp.message_id);
                 } else {
-                    if (smpp->smpp_msg_id_type & 0x01) {
+                    if ((smpp->smpp_msg_id_type & 0x01) || 
+                       (!octstr_check_range(pdu->u.submit_sm_resp.message_id, 0, octstr_len(pdu->u.submit_sm_resp.message_id), gw_isdigit))) {
                         tmp = octstr_format("%lu", strtoll(  /* hex */
                             octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 16));
                     } else {
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.