[Bugfix][T106BUG-157]Fix the apn information is set to the maximum length, buffer overflow.

Only Configure: No
Affected branch: master
Affected module: data
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I28a7ffc9c68996d9650561135ac6782886de9229
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index dc996f4..1f49fe6 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -628,10 +628,10 @@
     apn->profile_idx = (unsigned char)atoi(xmlGetProp(modify_node, "profile_idx"));
     apn->pdp_type = (qser_apn_pdp_type_e)atoi(xmlGetProp(modify_node, "pdp_type"));
     apn->auth_proto = (qser_apn_auth_proto_e)atoi(xmlGetProp(modify_node, "auth_proto"));
-    strcpy(apn->apn_name,(char *)xmlGetProp(modify_node, "apn_name"));
-    strcpy(apn->username,(char *)xmlGetProp(modify_node, "username"));
-    strcpy(apn->password,(char *)xmlGetProp(modify_node, "password"));
-    strcpy(apn->apn_type,(char *)xmlGetProp(modify_node, "apn_type"));
+    strncpy(apn->apn_name,(char *)xmlGetProp(modify_node, "apn_name"), QSER_APN_NAME_SIZE);
+    strncpy(apn->username,(char *)xmlGetProp(modify_node, "username"), QSER_APN_USERNAME_SIZE);
+    strncpy(apn->password,(char *)xmlGetProp(modify_node, "password"), QSER_APN_PASSWORD_SIZE);
+    strncpy(apn->apn_type,(char *)xmlGetProp(modify_node, "apn_type"), QSER_APN_NAME_SIZE);
     xmlSaveFormatFileEnc(data_xml_path, pdoc, "UTF-8", 1);
     xmlFreeDoc(pdoc);
     return RESULT_OK;
@@ -679,10 +679,10 @@
         apn_list->apn[node_num].profile_idx = (unsigned char)atoi(temp);
         apn_list->apn[node_num].pdp_type = (qser_apn_pdp_type_e)atoi(xmlGetProp(modify_node, "pdp_type"));
         apn_list->apn[node_num].auth_proto = (qser_apn_auth_proto_e)atoi(xmlGetProp(modify_node, "auth_proto"));
-        strcpy(apn_list->apn[node_num].apn_name,(char *)xmlGetProp(modify_node, "apn_name"));
-        strcpy(apn_list->apn[node_num].username,(char *)xmlGetProp(modify_node, "username"));
-        strcpy(apn_list->apn[node_num].password,(char *)xmlGetProp(modify_node, "password"));
-        strcpy(apn_list->apn[node_num].apn_type,(char *)xmlGetProp(modify_node, "apn_type"));
+        strncpy(apn_list->apn[node_num].apn_name,(char *)xmlGetProp(modify_node, "apn_name"), QSER_APN_NAME_SIZE);
+        strncpy(apn_list->apn[node_num].username,(char *)xmlGetProp(modify_node, "username"), QSER_APN_USERNAME_SIZE);
+        strncpy(apn_list->apn[node_num].password,(char *)xmlGetProp(modify_node, "password"), QSER_APN_PASSWORD_SIZE);
+        strncpy(apn_list->apn[node_num].apn_type,(char *)xmlGetProp(modify_node, "apn_type"), QSER_APN_NAME_SIZE);
         node_num ++;
         modify_node = modify_node->next;
     }
@@ -1082,6 +1082,7 @@
         LYERRLOG("apn_xml_modify error");
         return ret;
     }
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
     int apn_id = 0;
     char tmp_id[12];
     char *outinfo = NULL;
@@ -1098,7 +1099,8 @@
     LYINFLOG("[output]:%s",outinfo);
     free(outinfo);
     outinfo = NULL;
-    return RESULT_OK;
+#endif
+    return ret;
 }
 
 int qser_apn_get(unsigned char profile_idx, qser_apn_info_s *apn)
@@ -1132,6 +1134,7 @@
         LYERRLOG("apn_xml_add error");
         return ret;
     }
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
     int apn_id = 0;
     char tmp_id[12];
     char *outinfo = NULL;
@@ -1147,7 +1150,8 @@
     LYINFLOG("[output]:%s",outinfo);
     free(outinfo);
     outinfo = NULL;
-    return RESULT_OK;
+#endif
+    return ret;
 }
 
 int qser_apn_del(unsigned char profile_idx)
@@ -1164,6 +1168,7 @@
         LYERRLOG("apn_xml_delete error");
         return ret;
     }
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
     int apn_id = 0;
     char tmp_id[12];
     char *outinfo = NULL;
@@ -1176,6 +1181,7 @@
     LYINFLOG("[output]:%s",outinfo);
     free(outinfo);
     outinfo = NULL;
+#endif
     return ret;
 }