]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(mode_compile): Reject an invalid mode string that
authorJim Meyering <jim@meyering.net>
Thu, 20 Oct 2005 14:20:34 +0000 (14:20 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 20 Oct 2005 14:20:34 +0000 (14:20 +0000)
starts with an octal digit.  From Andreas Gruenbacher.

lib/modechange.c

index 6ab9cb6fdd5a539a97f91d51a130e19e51204dfa..52c5debca3a607c191990bca3db086885c4d0383 100644 (file)
@@ -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