mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Restrict octal perms to <= 07777. Cosmetic error message change.
This commit is contained in:
parent
1cb1b64c35
commit
ea4c43445c
@ -38,7 +38,7 @@
|
|||||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||||
{
|
{
|
||||||
if (!bb_parse_mode((char *)junk, &(statbuf->st_mode)))
|
if (!bb_parse_mode((char *)junk, &(statbuf->st_mode)))
|
||||||
bb_error_msg_and_die( "unknown mode: %s", (char *)junk);
|
bb_error_msg_and_die( "invalid mode: %s", (char *)junk);
|
||||||
if (chmod(fileName, statbuf->st_mode) == 0)
|
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
bb_perror_msg("%s", fileName); /* Avoid multibyte problems. */
|
bb_perror_msg("%s", fileName); /* Avoid multibyte problems. */
|
||||||
|
@ -65,7 +65,7 @@ extern int bb_parse_mode(const char *s, mode_t *current_mode)
|
|||||||
char *e;
|
char *e;
|
||||||
|
|
||||||
tmp = strtol(s, &e, 8);
|
tmp = strtol(s, &e, 8);
|
||||||
if (*e || (tmp > 0xffffU)) { /* Check range and trailing chars. */
|
if (*e || (tmp > 07777U)) { /* Check range and trailing chars. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*current_mode = tmp;
|
*current_mode = tmp;
|
||||||
|
Loading…
Reference in New Issue
Block a user