[Bugfix][T106BUG-407][T106BUG-406]fix apn_xml_modify 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: I42ea79ecda0a085f421f45bfcafaf65446d69919
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 eebf913..489bf64 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
@@ -563,9 +563,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)apn->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;
@@ -574,6 +587,11 @@
}
modify_node = modify_node->next;
}
+ if(modify_node == NULL)
+ {
+ LYERRLOG("modify_node is null\n");
+ goto FAILED;
+ }
bzero(temp_buff,12);
snprintf(temp_buff,sizeof(temp_buff),"%d",node_num);
xmlSetProp(modify_node,BAD_CAST"profile_idx",(xmlChar *)temp_buff);