[hackers] [sbase] tar: extract creation mode || Brad Barden

From: <git_AT_suckless.org>
Date: Fri, 20 Nov 2015 10:58:43 +0100 (CET)

commit 85a9254d3a21a8ec0468a0c8f1985649866fde75
Author: Brad Barden <brad_AT_13os.net>
AuthorDate: Wed Nov 18 20:49:07 2015 -0600
Commit: sin <sin_AT_2f30.org>
CommitDate: Fri Nov 20 09:58:38 2015 +0000

    tar: extract creation mode
    
    mode for newly-created files should be restrictive. chmod is always
    called soon after to set correct mode from the archive.

diff --git a/tar.c b/tar.c
index 1943e18..de58247 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -270,7 +270,7 @@ unarchive(char *fname, ssize_t l, char b[BLKSIZ])
         case RESERVED:
                 if ((mode = strtol(h->mode, &p, 8)) < 0 || *p != '\0')
                         eprintf("strtol %s: invalid number\n", h->mode);
- fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0644);
+ fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0600);
                 if (fd < 0)
                         eprintf("open %s:", fname);
                 if (fchmod(fd, mode) < 0)
Received on Fri Nov 20 2015 - 10:58:43 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 20 2015 - 11:00:16 CET