Added check to avoid segmentation fault

This commit is contained in:
Stefan Wahren 2012-05-06 21:55:39 +02:00
parent 42ed80a5b0
commit 6dd17954d2

View File

@ -2943,7 +2943,10 @@ mbus_str_xml_encode(u_char *dst, const u_char *src, size_t max_len)
i = 0;
len = 0;
while((len+6) < max_len) {
if (src != NULL)
{
while((len+6) < max_len)
{
if (src[i] == '\0')
{
break;
@ -2970,6 +2973,7 @@ mbus_str_xml_encode(u_char *dst, const u_char *src, size_t max_len)
i++;
}
}
dst[len] = '\0';
}