Stricter check for compliant phone numbers when adding and editing contacts

This commit is contained in:
Pierre Pronchery 2014-09-26 01:53:43 +03:00
parent 16b107fca1
commit ff6f7aee19

View File

@ -1658,8 +1658,7 @@ static char * _request_attention_contact_edit(unsigned int id,
char const cmd[] = "AT+CPBW=";
char buf[128];
if(number == NULL || strlen(number) == 0
|| name == NULL || strlen(name) == 0)
if(!_is_number(number) || name == NULL || strlen(name) == 0)
/* XXX report error */
return NULL;
if(snprintf(buf, sizeof(buf), "%s%u%s\"%s\"%s%u%s\"%s\"", cmd, id, ",",
@ -1689,8 +1688,7 @@ static char * _request_attention_contact_new(char const * name,
char const cmd[] = "AT+CPBW=";
char buf[128];
if(number == NULL || strlen(number) == 0
|| name == NULL || strlen(name) == 0)
if(!_is_number(number) || name == NULL || strlen(name) == 0)
/* XXX report error */
return NULL;
if(snprintf(buf, sizeof(buf), "%s%s\"%s\"%s%u%s\"%s\"", cmd, ",",