Merge "ipacm: Update xlat debug print to avoid ipacm crash"
diff --git a/ipacm/src/IPACM_Xml.cpp b/ipacm/src/IPACM_Xml.cpp
index 4451906..d59bbb0 100644
--- a/ipacm/src/IPACM_Xml.cpp
+++ b/ipacm/src/IPACM_Xml.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013, 2019, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -75,6 +75,7 @@
)
{
xmlNode* child_ptr;
+ uint32_t str_len;
for (child_ptr = element->children;
child_ptr != NULL;
@@ -82,7 +83,15 @@
{
if (child_ptr->type == XML_TEXT_NODE)
{
- return (char*)child_ptr->content;
+ str_len = strlen((char*)child_ptr->content);
+
+ if(str_len < MAX_XML_STR_LEN)
+ return (char*)child_ptr->content;
+ else
+ {
+ IPACMERR("Invalid string size\n");
+ break;
+ }
}
}
return NULL;