gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AT sms reading broken


From: Pavel Machek
Subject: Re: AT sms reading broken
Date: Sat, 14 Sep 2002 18:16:45 +0200
User-agent: Mutt/1.4i

Hi!

> > There's something wrong with atgen.c message reading:
> 
> It's probably because noone really tested it. I just did the quick
> fix and

Where can I find that quick fix?

> quick test (probably for the plain 7bit messages) and then it compiled
> successfully and worked. Feel free to submit the changes.

Can you try to put few unsent messages (write locally, do not send but
save), and do --getsms ME 1 10?

> > Next, it sometimes goes out of sync (like getting command echo instead
> > of reply, or getting unexpected okay), and gnokii segfaults if sms_len
> > is too small. I can reliably trigger that fprintf() by --getsms ME 1
> > 10 on siemens.
> 
> That's not good. Could you please trace the place where is
> > segfaults?

I'm using following diff to prevent segfaults:

[I'll send you dumps privately]

Index: common/Makefile
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/Makefile,v
retrieving revision 1.45
diff -u -u -r1.45 Makefile
--- common/Makefile     7 Aug 2002 21:19:11 -0000       1.45
+++ common/Makefile     14 Sep 2002 16:15:53 -0000
@@ -54,7 +54,8 @@
        $(MAKE) -C devices DEVICES.o
 
 gnokii-debug: $(OBJS) phones/PHONES.o links/LINKS.o devices/DEVICES.o 
gsm-filetypes.o ../gnokii/gnokii.o
-       $(CC) -o gnokii-debug $(OBJS) phones/PHONES.o links/LINKS.o 
devices/DEVICES.o gsm-filetypes.o ../gnokii/gnokii.o
+       $(CC) -g -o gnokii-debug $(OBJS) phones/PHONES.o links/LINKS.o 
devices/DEVICES.o gsm-filetypes.o ../gnokii/gnokii.o /usr/X11/lib/libXpm.a 
/usr/X11/lib/libX11.a
+# -lefence
 
 libgnokii.so: $(OBJS) phones/PHONES.o links/LINKS.o devices/DEVICES.o
        $(CC) -shared -o libgnokii.so $(OBJS) phones/PHONES.o links/LINKS.o 
devices/DEVICES.o
Index: common/links/atbus.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/links/atbus.c,v
retrieving revision 1.19
diff -u -u -r1.19 atbus.c
--- common/links/atbus.c        13 Sep 2002 22:40:00 -0000      1.19
+++ common/links/atbus.c        14 Sep 2002 16:15:56 -0000
@@ -26,6 +26,8 @@
 
 */
 
+#define DEBUG
+
 /* System header files */
 #include <stdio.h>
 #include <string.h>
Index: common/phones/atgen.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/phones/atgen.c,v
retrieving revision 1.53
diff -u -u -r1.53 atgen.c
--- common/phones/atgen.c       13 Sep 2002 22:40:00 -0000      1.53
+++ common/phones/atgen.c       14 Sep 2002 16:16:08 -0000
@@ -24,12 +24,15 @@
 
   Copyright (C) 2001 Manfred Jonsson <address@hidden>
   Copyright (C) 2002 Pawel Kot <address@hidden>
+  Copyright (C) 2002 Pavel Machek <address@hidden>
 
   This file provides functions specific to generic at command compatible
   phones. See README for more details on supported mobile phones.
 
 */
 
+#define DEBUG
+
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -1043,6 +1046,11 @@
        data->RawSMS->DCS              = tmp[offset + 2];
        memcpy(data->RawSMS->SMSCTime, tmp + offset + 3, 7);
        data->RawSMS->Length           = tmp[offset + 10] & 0x00ff;
+       if (sms_len - offset - 11 > 1000) {
+               fprintf(stderr, "Phone gave as poisonous (too short?) reply %s, 
either phone went crazy or communication went out of sync\n", buf.line3);
+               free(tmp);
+               return GE_INTERNALERROR;
+       }
        memcpy(data->RawSMS->UserData, tmp + offset + 11, sms_len - offset - 
11);
        free(tmp);
        return GE_NONE;


                                                                Pavel
-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]