From 456202f2327c6366a89250dda7f5286e2deeb4f0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 30 Dec 2015 14:24:00 +0100 Subject: the DEL char must be quoted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/satd-list.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/satd-list.c b/src/satd-list.c index 08d0f75..0f0cfa9 100644 --- a/src/satd-list.c +++ b/src/satd-list.c @@ -40,17 +40,18 @@ quote(const char *str) { #define UNSAFE(c) strchr(" \"$()[]{};|&^#!?*~`<>", c) - size_t in = 0; /* < ' ' */ - size_t sn = 0; /* in UNSAFE */ - size_t bn = 0; /* = '\\' */ - size_t qn = 0; /* = '\'' */ - size_t rn = 0; /* other */ + size_t in = 0; /* < ' ' or 127 */ + size_t sn = 0; /* in UNSAFE */ + size_t bn = 0; /* = '\\' */ + size_t qn = 0; /* = '\'' */ + size_t rn = 0; /* other */ size_t n, i = 0; const unsigned char *s; char *rc = NULL; for (s = (const unsigned char *)str; *s; s++) { if (*s < ' ') in++; + else if (*s == 127) in++; else if (UNSAFE(*s)) sn++; else if (*s == '\\') bn++; else if (*s == '\'') qn++; @@ -77,7 +78,7 @@ quote(const char *str) rc[i++] = '$'; rc[i++] = '\''; for (s = (const unsigned char *)str; *s; s++) { - if (*s < ' ') { + if ((*s < ' ') || (*s == 127)) { rc[i++] = '\\'; rc[i++] = 'x'; rc[i++] = "0123456789ABCDEF"[(*s >> 4) & 15]; -- cgit v1.2.3-70-g09d2