[Bugfix][T106BUG-334][T106BUG-335] fix apn_xml_delete Segmentation fault
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: Iea2a4a9a08f1b0a6070a123c47f54a628535090f
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 1f49fe6..47b5562 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
@@ -474,9 +474,22 @@
goto FAILED;
}
modify_node = node->xmlChildrenNode;
- modify_node = modify_node->next;
+ if(modify_node != NULL)
+ {
+ modify_node = modify_node->next;
+ }
+ else
+ {
+ LYERRLOG("modify_node is null\n");
+ goto FAILED;
+ }
for (node_num=0 ;node_num<(int)profile_idx ; node_num++)
{
+ if(modify_node == NULL)
+ {
+ LYERRLOG("modify_node is null\n");
+ goto FAILED;
+ }
if (xmlGetProp(modify_node, "profile_idx") == NULL) //Null Node
{
modify_node = modify_node->next;
@@ -485,6 +498,11 @@
}
modify_node = modify_node->next;
}
+ if(modify_node == NULL)
+ {
+ LYERRLOG("modify_node is null\n");
+ goto FAILED;
+ }
xmlUnlinkNode(modify_node);
xmlFreeNode(modify_node);
modify_node = NULL;
@@ -619,11 +637,11 @@
continue;
}
modify_node = modify_node->next;
- if(modify_node == NULL)
- {
- LYERRLOG("modify_node is null\n");
- goto FAILED;
- }
+ }
+ if(modify_node == NULL)
+ {
+ LYERRLOG("modify_node is null\n");
+ goto FAILED;
}
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"));