While browsing through the code a little bit, I found an error in
at_receive_msg() in smsc_at.c.
The function looks like this:
/***************************************************************************
***
* There are messages to read!
*/
int at_receive_msg(SMSCenter *smsc, Msg **msg) {
*msg = list_consume(smsc->at_received);
if(msg == NULL) /* Chimit: Should be: if (*msg == NULL) */
goto error;
return 1;
error:
return -1;
}
Hopefully, msg will never be NULL at the time the if-expression is
evaluated. Or we will get a segfault in the line before.
Below is a suggested patch. (sorry, I am in a webmail interface atm - that
cannot handle attachments).
cvs server: Diffing gw/smsc
Index: gw/smsc/smsc_at.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at.c,v
retrieving revision 1.1
diff -u -r1.1 smsc_at.c
--- gw/smsc/smsc_at.c 8 Aug 2002 17:44:38 -0000 1.1
+++ gw/smsc/smsc_at.c 19 Sep 2002 13:59:09 -0000
@@ -399,7 +399,7 @@
int at_receive_msg(SMSCenter *smsc, Msg **msg) {
*msg = list_consume(smsc->at_received);
- if(msg == NULL)
+ if(*msg == NULL)
goto error;
return 1;