Ticket #1643 (closed defect: community)

Opened 9 years ago

Last modified 8 years ago

strip unwanted non-digits from SMS numbers

Reported by: nomeata Owned by: openmoko-devel
Priority: normal Milestone: Om2007.2
Component: unknown Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: no PatchReviewResult:
Reproducible:

Description

Hi,

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 |
                        GSMD_TOA_RESERVED;
                strcpy(dst->number, src + skipplus);
        } else {
                dst->type =
                        GSMD_TOA_NPI_ISDN |
                        GSMD_TOA_TON_UNKNOWN |
                        GSMD_TOA_RESERVED;
                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.

Change History

comment:1 Changed 8 years ago by john_lee

  • Status changed from new to closed
  • HasPatchForReview unset
  • Resolution set to community

Om will not maintain gsmd anymore, so we should check this in fso instead.

Note: See TracTickets for help on using tickets.