diff options
author | mjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-03-19 18:09:03 +0000 |
---|---|---|
committer | mjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-03-19 18:09:03 +0000 |
commit | b870b5666edc22263db5f810d59404603288f3be (patch) | |
tree | 01295b8a4b3f31ff3684c0dbc61c6e4182d31466 | |
parent | cabb42663579edbeb65ccf3222c21e978dd2c1cc (diff) | |
download | busybox-w32-b870b5666edc22263db5f810d59404603288f3be.tar.gz busybox-w32-b870b5666edc22263db5f810d59404603288f3be.tar.bz2 busybox-w32-b870b5666edc22263db5f810d59404603288f3be.zip |
Restrict octal perms to <= 07777. Cosmetic error message change.
git-svn-id: svn://busybox.net/trunk/busybox@6754 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | coreutils/chmod.c | 2 | ||||
-rw-r--r-- | libbb/parse_mode.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 28c98552a..a9758d58b 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -38,7 +38,7 @@ | |||
38 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | 38 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) |
39 | { | 39 | { |
40 | if (!bb_parse_mode((char *)junk, &(statbuf->st_mode))) | 40 | if (!bb_parse_mode((char *)junk, &(statbuf->st_mode))) |
41 | bb_error_msg_and_die( "unknown mode: %s", (char *)junk); | 41 | bb_error_msg_and_die( "invalid mode: %s", (char *)junk); |
42 | if (chmod(fileName, statbuf->st_mode) == 0) | 42 | if (chmod(fileName, statbuf->st_mode) == 0) |
43 | return (TRUE); | 43 | return (TRUE); |
44 | bb_perror_msg("%s", fileName); /* Avoid multibyte problems. */ | 44 | bb_perror_msg("%s", fileName); /* Avoid multibyte problems. */ |
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index 49573dfbb..7132c76ef 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c | |||
@@ -65,7 +65,7 @@ extern int bb_parse_mode(const char *s, mode_t *current_mode) | |||
65 | char *e; | 65 | char *e; |
66 | 66 | ||
67 | tmp = strtol(s, &e, 8); | 67 | tmp = strtol(s, &e, 8); |
68 | if (*e || (tmp > 0xffffU)) { /* Check range and trailing chars. */ | 68 | if (*e || (tmp > 07777U)) { /* Check range and trailing chars. */ |
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | *current_mode = tmp; | 71 | *current_mode = tmp; |