summaryrefslogtreecommitdiff
path: root/libmisc
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2003-08-03 23:48:33 +0000
committerNathan Scott <nathans@sgi.com>2003-08-03 23:48:33 +0000
commitc061323a613bdf17b35dea9aece285f06273a0d1 (patch)
tree5bca5c1dbfc0011f7283510059c8a6dab60992da /libmisc
parentd141df65f1b4ebb05f57d74b4afd1e8812f327d5 (diff)
downloadattr-c061323a613bdf17b35dea9aece285f06273a0d1.tar.gz
Fix up quote/unquote routines to handle NULL as input, fixes SEGVs in several ACL tools
Diffstat (limited to 'libmisc')
-rw-r--r--libmisc/quote.c3
-rw-r--r--libmisc/unquote.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/libmisc/quote.c b/libmisc/quote.c
index 633f941..fdd3af9 100644
--- a/libmisc/quote.c
+++ b/libmisc/quote.c
@@ -31,6 +31,9 @@ const char *quote(const char *str)
char *q;
size_t nonpr;
+ if (!str)
+ return str;
+
for (nonpr = 0, s = (unsigned char *)str; *s != '\0'; s++)
if (!isprint(*s) || isspace(*s) || *s == '\\')
nonpr++;
diff --git a/libmisc/unquote.c b/libmisc/unquote.c
index a3bf6fe..a6992da 100644
--- a/libmisc/unquote.c
+++ b/libmisc/unquote.c
@@ -27,6 +27,9 @@ char *unquote(char *str)
{
unsigned char *s, *t;
+ if (!str)
+ return str;
+
for (s = (unsigned char *)str; *s != '\0'; s++)
if (*s == '\\')
break;