Thanks,

I'm a newbie in the open source community and (obviously) still learning the
coding etiquette.
About the tabs<->spaces matter, my coding is already done with tabs
converted to spaces, tabsize=4.
In fact, it's the cvs diff -u command that generates the tabs in the patch
file, not me...
"My" lines (with the leading +) do not contain tabs.

Perhaps the
--expand-tabs
can be useful as an extra option in
cvs diff -u
command?

Anyway, here's the patch generated with
cvs diff -u --expand-tabs,
I believe it's ok now.

Regards,
Andrija



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of
Alexander Malysh
Sent: Wednesday, May 10, 2006 1:56 PM
To: devel@kannel.org
Subject: Re: smsc_at crashes on non-numeric SMS destination


Hi,

you patch looks good but please fix indentation...

Index: gateway/gw/smsc/smsc_at.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at.c,v
retrieving revision 1.29
diff -u -b -B -u -r1.29 smsc_at.c
--- gateway/gw/smsc/smsc_at.c   24 Apr 2006 21:32:01 -0000      1.29
+++ gateway/gw/smsc/smsc_at.c   9 May 2006 12:03:22 -0000
@@ -2649,13 +2649,20 @@
                            );

     /* grab the digits from the MSISDN and encode as swapped semi-octets */
-    while (octstr_len(temp)) {
+    while ((out)&&(octstr_len(temp))) {

kill extra '()' and put space between checks, while (out !+ NULL && ...)

        int digit1, digit2;
        /* get the first two digit */
        digit1 = octstr_get_char(temp,0) - 48;
-       if ((digit2 = octstr_get_char(temp,1) - 48) < 0)
+        digit2 = octstr_get_char(temp,1) - '0';
+        if (digit2 < 0)
            digit2 = 0x0F;
+        if((digit1>=0)&&(digit1<16)&&(digit2<16)) {

ditto

        octstr_append_char(out, (digit2 << 4) | digit1);

if you at it, please kill tab and replace with spaces

+        }
+        else {
+            O_DESTROY(out);
+            out = NULL;
+        }
        octstr_delete(temp, 0, 2);

ditto

     }



Andrija Petrovic wrote:

> smsc_at does not check the digits of the address field in the function
> at2_format_address_field
> So, if the recipient's address contains a non-numeric string (e.g. 'Info
> Service'), and that's quite possible,
> the octstr assertion crashes the bearerbox during octstr_append_char.
>
> Added sanity check on digits before calling the octstr_append_char.
>
> cheers,
> Andrija

--
Thanks,
Alex




Attachment: smsc_at.c.diff
Description: Binary data

Reply via email to