From cca51b9e45460e05bf5da81be80a26a70a120704 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 27 Nov 2014 13:36:09 +0100 Subject: include/carefulputc: encode also ' and $ in fputs_quoted() output This change is important for commands linked with libsmartcols (e.g. lsblk(1)) to make it more safe for crazy scenarios like eval $(lsblk --fs --pairs /dev/sdb1) where the command returns NAME="value" from filesystem LABELS (etc.) Signed-off-by: Karel Zak --- include/carefulputc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/carefulputc.h') diff --git a/include/carefulputc.h b/include/carefulputc.h index c116d0a98..3a0ec5b66 100644 --- a/include/carefulputc.h +++ b/include/carefulputc.h @@ -34,6 +34,8 @@ static inline void fputs_quoted(const char *data, FILE *out) for (p = data; p && *p; p++) { if ((unsigned char) *p == 0x22 || /* " */ (unsigned char) *p == 0x5c || /* \ */ + (unsigned char) *p == 0x60 || /* ` */ + (unsigned char) *p == 0x24 || /* $ */ !isprint((unsigned char) *p) || iscntrl((unsigned char) *p)) { -- cgit v1.2.3-55-g7522