[PATCH] udisks: escape backslash for label string

Jiro SEKIBA jir at unicus.jp
Thu Oct 14 21:48:07 PDT 2010


validate_and_escape_label will only escapes '"'.
However, string '\"' will be escaped to '\\"' which leads unmatched
double quote for shell string in result.

This adds escaping '\' in validate_and_escape_label to avoid the problem.

Signed-off-by: Jiro SEKIBA <jir at unicus.jp>
---
 src/helpers/job-shared.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/helpers/job-shared.h b/src/helpers/job-shared.h
index cf78474..2a032a3 100644
--- a/src/helpers/job-shared.h
+++ b/src/helpers/job-shared.h
@@ -216,6 +216,11 @@ validate_and_escape_label (char **label,
           g_string_insert_c (s, n, '\\');
           n++;
         }
+      else if (s->str[n] == '\\')
+        {
+          g_string_insert_c (s, n, '\\');
+          n++;
+        }
     }
   g_free (*label);
   *label = g_string_free (s, FALSE);
-- 
1.7.0.4



More information about the devkit-devel mailing list