From e7a0892fd17c6d5648bede1c0ae8f20f1cb8f2c6 Mon Sep 17 00:00:00 2001 From: Patrick Winnertz Date: Tue, 6 Jan 2009 22:48:30 +0100 Subject: [PATCH] Fix escaping functions to also escape the leading whitespace --- src/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index df46b2b40..79d94122c 100644 --- a/src/util.c +++ b/src/util.c @@ -1542,7 +1542,7 @@ unescape_string ( const char * in ) { j = j + 20; local = g_realloc(local,j); } - if ( (strchr(" \t*|;<>~#()?[]{}&",in[i])) && ( strchr("\\",in[i-1])) ) { + if ( (strchr(" \t*|;<>~#()?[]{}&",in[i])) && ((i == 0) || ( strchr("\\",in[i-1]))) ) { k++; local[i-k] = in[i]; } else { @@ -1570,7 +1570,7 @@ escape_string ( const char * in ) { j = j + 20; local = g_realloc(local,j); } - if ( (strchr(" \t*|;<>~#()?[]{}&",in[i])) && (! strchr("\\",in[i-1])) ) { + if ( (strchr(" \t*|;<>~#()?[]{}&",in[i])) && ((i == 0) || (! strchr("\\",in[i-1]))) ) { local[i+k] = 92; // Ascii for "\" k = k+1; local[i+k] = in[i]; -- 2.11.4.GIT