scd: Fix status info encoding.
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 14 Nov 2016 01:25:43 +0000 (10:25 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 30 Nov 2016 00:30:18 +0000 (09:30 +0900)
* scd/command.c (send_status_info): Do percent plus encoding correctly.

--
Backport of master commit: 4ee4d0b02172cf56d9582bb99e32a65c75315b25

Reported-by: David Härdeman <david@hardeman.nu>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
scd/command.c

index 963cb3e..2c43a3a 100644 (file)
@@ -2103,7 +2103,8 @@ send_status_info (ctrl_t ctrl, const char *keyword, ...)
         }
       for ( ; valuelen && n < DIM (buf)-2; n++, valuelen--, value++)
         {
-          if (*value < ' ' || *value == '+')
+          if (*value == '+' || *value == '\"' || *value == '%'
+              || *value < ' ')
             {
               sprintf (p, "%%%02X", *value);
               p += 3;