summaryrefslogtreecommitdiff
path: root/lib/modechange.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-10-20 14:20:34 +0000
committerJim Meyering <jim@meyering.net>2005-10-20 14:20:34 +0000
commita4667affc0129753b5f852d1ec2f02b5dee8040f (patch)
tree0f63645fb08fd0cbd4cec3fca947b59279343469 /lib/modechange.c
parent7aff553950358e01feee110f9365d7062bfc4972 (diff)
downloadcoreutils-a4667affc0129753b5f852d1ec2f02b5dee8040f.tar.xz
(mode_compile): Reject an invalid mode string that
starts with an octal digit. From Andreas Gruenbacher.
Diffstat (limited to 'lib/modechange.c')
-rw-r--r--lib/modechange.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/modechange.c b/lib/modechange.c
index 6ab9cb6fd..52c5debca 100644
--- a/lib/modechange.c
+++ b/lib/modechange.c
@@ -124,6 +124,9 @@ mode_compile (char const *mode_string)
}
while ('0' <= *mode_string && *mode_string < '8');
+ if (*mode_string)
+ return NULL;
+
/* Help the compiler optimize the usual case where mode_t uses
the traditional octal representation. */
mode = ((S_ISUID == SUID && S_ISGID == SGID && S_ISVTX == SVTX