Index: smsc_at.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at.c,v
retrieving revision 1.33
diff -u -r1.33 smsc_at.c
--- smsc_at.c	7 Jan 2007 23:52:53 -0000	1.33
+++ smsc_at.c	22 Feb 2007 12:03:51 -0000
@@ -1487,6 +1487,10 @@
               + at2_hexchar(octstr_get_char(buffer, pos + 1));
         if (tmp < 0)
             goto nomsg;
+	if (tmp == 0) {
+	    info(0, "AT2[%s]: received message without smsc number - consider setting no-smsc", octstr_get_cstr(privdata->name));
+	    goto nosmsc;
+	}
        
         numtmp = octstr_create_from_data(octstr_get_cstr(buffer)+pos+2,tmp * 2);	/* we now have the hexchars of the SMSC in GSM encoding */
 		octstr_hex_to_binary(numtmp);
@@ -1498,6 +1502,7 @@
         pos += 2 + tmp * 2;
     }
 
+nosmsc:
     /* check if the buffer is long enough to contain the full message */
     if (!privdata->modem->broken && octstr_len(buffer) < len * 2 + pos)
         goto nomsg;
@@ -1537,6 +1542,8 @@
 
 	pos=0;
     len = octstr_len(pdu);
+    if(len==0)
+        return octstr_create("");
 	
     ton = octstr_get_char(pdu,pos++);
     npi = ton & 0x0F;
