diff options
author | Martin Matuska <mm@FreeBSD.org> | 2016-10-04 11:44:21 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2016-10-04 11:44:21 +0000 |
commit | adb01b286db1dc63ea40381f42f6124b9e695253 (patch) | |
tree | 34ca5744d8d31a6f502d9f4b122da8606a044b2e /cat | |
parent | 282f8bd6960fef410b548a8bec8f3f3ddfb3498c (diff) | |
download | src-adb01b286db1dc63ea40381f42f6124b9e695253.tar.gz src-adb01b286db1dc63ea40381f42f6124b9e695253.zip |
Update vendor/libarchive to git 024be27d1b299c030e8841bed3002ee07ba9eedc
Important vendor bugfixes (relevant to FreeBSD):
#747: Out of bounds read in mtree parser
#761: heap-based buffer overflow in read_Header (7-zip)
#784: Invalid file on bsdtar command line results in internal errors (1)
PR: 213092 (1)
Obtained from: https://github.com/libarchive/libarchive
Notes
Notes:
svn path=/vendor/libarchive/dist/; revision=306669
Diffstat (limited to 'cat')
-rw-r--r-- | cat/test/main.c | 39 | ||||
-rw-r--r-- | cat/test/test.h | 1 |
2 files changed, 38 insertions, 2 deletions
diff --git a/cat/test/main.c b/cat/test/main.c index 0aa1deb572b3..29f7b14b1849 100644 --- a/cat/test/main.c +++ b/cat/test/main.c @@ -1360,6 +1360,31 @@ assertion_file_birthtime_recent(const char *file, int line, return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); } +/* Verify mode of 'pathname'. */ +int +assertion_file_mode(const char *file, int line, const char *pathname, int expected_mode) +{ + int mode; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + failure_start(file, line, "assertFileMode not yet implemented for Windows"); +#else + { + struct stat st; + r = lstat(pathname, &st); + mode = (int)(st.st_mode & 0777); + } + if (r == 0 && mode == expected_mode) + return (1); + failure_start(file, line, "File %s has mode %o, expected %o", + pathname, mode, expected_mode); +#endif + failure_finish(NULL); + return (0); +} + /* Verify mtime of 'pathname'. */ int assertion_file_mtime(const char *file, int line, @@ -1578,8 +1603,12 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode) if (0 == _mkdir(dirname)) return (1); #else - if (0 == mkdir(dirname, mode)) - return (1); + if (0 == mkdir(dirname, mode)) { + if (0 == chmod(dirname, mode)) { + assertion_file_mode(file, line, dirname, mode); + return (1); + } + } #endif failure_start(file, line, "Could not create directory %s", dirname); failure_finish(NULL); @@ -1628,6 +1657,11 @@ assertion_make_file(const char *file, int line, failure_finish(NULL); return (0); } + if (0 != chmod(path, mode)) { + failure_start(file, line, "Could not chmod %s", path); + failure_finish(NULL); + return (0); + } if (contents != NULL) { ssize_t wsize; @@ -1644,6 +1678,7 @@ assertion_make_file(const char *file, int line, } } close(fd); + assertion_file_mode(file, line, path, mode); return (1); #endif } diff --git a/cat/test/test.h b/cat/test/test.h index c5d2363040f8..1d219647560f 100644 --- a/cat/test/test.h +++ b/cat/test/test.h @@ -241,6 +241,7 @@ int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); +int assertion_file_mode(const char *, int, const char *, int); int assertion_file_mtime(const char *, int, const char *, long, long); int assertion_file_mtime_recent(const char *, int, const char *); int assertion_file_nlinks(const char *, int, const char *, int); |