[network-manager-openvpn/th/export-bgo764132: 4/27] fixup! properties: refactor export code to properly escape strings



commit d850c343228f478c6ce94581b60bf48afdd7c1bd
Author: Thomas Haller <thaller redhat com>
Date:   Fri Mar 25 20:34:43 2016 +0100

    fixup! properties: refactor export code to properly escape strings

 properties/import-export.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index f92cec2..664cc27 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1543,12 +1543,14 @@ escape_arg (const char *value, char **buf)
                result[1 + len] = '\'';
                result[2 + len] = '\0';
        } else {
-               i_result = result = g_malloc (len * 2 + 1);
+               i_result = result = g_malloc (len * 2 + 3);
+               *(i_result++) = '"';
                for (s = value; s[0]; s++) {
                        if (NM_IN_SET (s[0], '\\', '"'))
                                *(i_result++) = '\\';
                        *(i_result++) = s[0];
                }
+               *(i_result++) = '"';
                *(i_result++) = '\0';
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]