convert all control chars into spaces to be xml 1.0 conform

This commit is contained in:
Stefan Wahren 2012-09-16 18:15:55 +02:00
parent 564483e092
commit 1ae8869d7b

View File

@ -9,6 +9,7 @@
//------------------------------------------------------------------------------
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
@ -3227,6 +3228,13 @@ mbus_str_xml_encode(u_char *dst, const u_char *src, size_t max_len)
break;
}
if (iscntrl(src[i]))
{
// convert all control chars into spaces
dst[len++] = ' ';
}
else
{
switch (src[i])
{
case '&':
@ -3245,6 +3253,7 @@ mbus_str_xml_encode(u_char *dst, const u_char *src, size_t max_len)
dst[len++] = src[i];
break;
}
}
i++;
}