Fix: UTF-8 characters may be stored on up to 4 bytes
[lttng-tools.git] / src / common / config / config.c
index 03601be486deacc189f260251108534156aa0c1c..140f3b6dc097371de12f15185b4710dd0c6f8579 100644 (file)
@@ -340,11 +340,10 @@ static xmlChar *encode_string(const char *in_str)
 
        in_len = strlen(in_str);
        /*
-        * Add 1 byte for the NULL terminted character. The factor 2 here is
-        * because UTF-8 can be on two bytes so this fits the worst case for each
-        * bytes.
+        * Add 1 byte for the NULL terminted character. The factor 4 here is
+        * used because UTF-8 characters can take up to 4 bytes.
         */
-       out_len = (in_len * 2) + 1;
+       out_len = (in_len * 4) + 1;
        out_str = xmlMalloc(out_len);
        if (!out_str) {
                goto end;
This page took 0.022729 seconds and 4 git commands to generate.