* fix crash when network_opers_parse returns error * add support for ",," (TS 07.07 and TS 27.007 section 7.3) * add support for 3G COPS answer (TS 27.007 section 7.3)
Index: src/gsmd/usock.c =================================================================== --- src/gsmd/usock.c (revision 4087) +++ src/gsmd/usock.c (working copy) @@ -899,6 +899,14 @@ if (strncmp(str, "+COPS: ", 7)) return -EINVAL; + /* + * string ",," means the begginig of extended parameters and we + * don't want to scan them for operators. + */ + ptr = strstr(str, ",,"); + if(ptr) + ptr[0] = '\0'; + ptr = str; while (*str) { if ( *str == '(' && isdigit(*(str+1)) ) { @@ -935,7 +943,7 @@ //extrsp_dump(er); - if ( er->num_tokens == 4 && + if ( er->num_tokens >= 4 && er->tokens[0].type == GSMD_ECMD_RTT_NUMERIC && er->tokens[1].type == GSMD_ECMD_RTT_STRING && er->tokens[2].type == GSMD_ECMD_RTT_STRING && @@ -979,6 +987,8 @@ int len, ret; len = network_opers_parse(resp, &buf); + if(len < 0) + return len; /* error we got from network_opers_parse */ ret = gsmd_ucmd_submit(gu, GSMD_MSG_NETWORK, GSMD_NETWORK_OPER_LIST, cmd->id, sizeof(*buf) * (len + 1), buf);