Openmoko Bug #1643: strip unwanted non-digits from SMS numbers

Openmoko Public Trac bugs at
Sat Jul 19 21:20:01 CEST 2008

#1643: strip unwanted non-digits from SMS numbers
 Reporter:  nomeata  |       Owner:  openmoko-devel
     Type:  defect   |      Status:  new           
 Priority:  normal   |   Milestone:  OM-2007.2     
Component:  unknown  |     Version:                
 Severity:  normal   |    Keywords:                
 Blocking:           |   Blockedby:                

 While the dialer works fine if I use a number that contains a / or other
 non-digits, e.g. when using a number from the phone book, I can not send
 SMS without manually removing the slash first.

 I assume this is caused by this code in libgsmd_sms.c:

 int lgsm_number2addr(struct gsmd_addr *dst, const char *src, int skipplus)
         char *ch;

         if (strlen(src) + 1 > sizeof(dst->number))
                 return 1;
         if (src[0] == '+') {
                 dst->type =
                         GSMD_TOA_NPI_ISDN |
                         GSMD_TOA_TON_INTERNATIONAL |
                 strcpy(dst->number, src + skipplus);
         } else {
                 dst->type =
                         GSMD_TOA_NPI_ISDN |
                         GSMD_TOA_TON_UNKNOWN |
                 strcpy(dst->number, src);

         for (ch = dst->number; *ch; ch ++)
                 if (*ch < '0' || *ch > '9')
                         return 1;
         return 0;

 The last lines throw away any number that contains non-digits. If these
 are a problem, they should be stripped instead of thrown away. But I might
 be wrong, and the number should already be stripped at some other point...

 The bug was reported on the mailing list by others as well.

Ticket URL: <> <>
openmoko trac

More information about the devel mailing list