]> arthur.barton.de Git - netatalk.git/commitdiff
Expand list of shell metacharacters to escape in variable substitution. Courtesty...
authormorgana <morgana>
Wed, 28 Jan 2009 18:03:15 +0000 (18:03 +0000)
committermorgana <morgana>
Wed, 28 Jan 2009 18:03:15 +0000 (18:03 +0000)
etc/papd/lp.c

index c6572cc9dbd0513354a738b5eb2d454f15b594a2..ee7d7274e0978f1fc458c487247fc6d640624ec0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: lp.c,v 1.21 2009-01-21 02:43:46 didg Exp $
+ * $Id: lp.c,v 1.22 2009-01-28 18:03:15 morgana Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -217,7 +217,26 @@ size_t used = 0;
           case '$':
           case '\\':
           case '"':
+          case ';':
+          case '&':
+          case '(':
+          case ')':
+          case ' ':
+          case '*':
+          case '#':
+          case '|':
+          case '>':
+          case '<':
+          case '[':
+          case ']':
+          case '{':
+          case '}':
+          case '^':
+          case '?':
+          case '~':
           case '`':
+          case '\x0A':
+          case '\xFF':
             if (used + 2 > bsize )
               return used;
             *dest = '\\';
@@ -247,9 +266,9 @@ static char* pipexlate(char *src)
     if (!src)
        return NULL;
 
-    memset(dest, 0, MAXPATHLEN +1);
+    memset(dest, 0, sizeof(destbuf));
     if ((p = strchr(src, '%')) == NULL) { /* nothing to do */
-        strncpy(dest, src, MAXPATHLEN);
+        strncpy(dest, src, sizeof(dest) - 1);
         return destbuf;
     }
     /* first part of the path. copy and forward to the next variable. */