s_network: fix search network request result parse error 41/8441/1
authorCaiwen Zhang <caiwen.zhang@intel.com>
Sat, 8 Jun 2013 18:18:36 +0000 (02:18 +0800)
committerwootak.jung <wootak.jung@samsung.com>
Tue, 20 Aug 2013 00:28:17 +0000 (09:28 +0900)
Change-Id: I0c0b5e155e2ef0aa6c9b92396b4ecb658f380081

src/s_network.c

index 17ffa9c..68da560 100755 (executable)
@@ -408,20 +408,17 @@ static void on_response_search_network(TcorePending *p, int data_len, const void
                        if ((pResp = tcore_at_tok_nth(network_token, 1))) {     /* Long Alpha name */
                                dbg("Long Alpha name : %s", pResp);
 
-                               if (strlen(pResp) > 0) {
-                                       alpha_name = tcore_at_tok_extract((const char *)pResp);
-                                       strncpy(resp.list[i].name, alpha_name, 39);
-                                       resp.list[i].name[39] = '\0';
-                               }
-                       } else if ((pResp = tcore_at_tok_nth(network_token, 2))) {
-                               dbg("Short Alpha name : %s", pResp);
-                               /* Short Alpha name */
+                               if (strlen(pResp) > 0)
+                                       /* Strip off starting quote & ending quote */
+                                       strncpy(resp.list[i].name, pResp + 1, strlen(pResp) - 2);
+                       }
 
-                               if (strlen(pResp) > 0) {
-                                       alpha_name = tcore_at_tok_extract((const char *)pResp);
-                                       strncpy(resp.list[i].name, alpha_name, 39);
-                                       resp.list[i].name[39] = '\0';
-                               }
+                       if ((pResp = tcore_at_tok_nth(network_token, 2))) {
+                               dbg("Short Aplha name : %s", pResp);
+                               /* Short Aplha name */
+                               /* Strip off starting quote & ending quote */
+                               if (strlen(pResp) > 0)
+                                       strncpy(resp.list[i].name, pResp + 1, strlen(pResp) - 2);
                        }
 
                        /* PLMN ID */
@@ -434,7 +431,7 @@ static void on_response_search_network(TcorePending *p, int data_len, const void
                        }
 
                        /* Parse Access Technology */
-                       if ((pResp = tcore_at_tok_nth(tokens, 4))) {
+                       if ((pResp = tcore_at_tok_nth(network_token, 4))) {
                                if (strlen(pResp) > 0) {
                                        AcT = atoi(pResp);