summaryrefslogtreecommitdiffstats
path: root/lib/libarchive
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2009-12-29 05:52:13 +0000
committerkientzle <kientzle@FreeBSD.org>2009-12-29 05:52:13 +0000
commit9f1cacc2a4e4ab5b3bdd05679a9a1d8efad3d94e (patch)
treedfbaea41c4bc40cb4a690fe1c5af728e511bde96 /lib/libarchive
parenta587aab420ace76053f95f5fe6ce50aa98c02b5f (diff)
downloadFreeBSD-src-9f1cacc2a4e4ab5b3bdd05679a9a1d8efad3d94e.zip
FreeBSD-src-9f1cacc2a4e4ab5b3bdd05679a9a1d8efad3d94e.tar.gz
Minor style fixes plus a fix for an obscure crash on certain malformed
mtree files.
Diffstat (limited to 'lib/libarchive')
-rw-r--r--lib/libarchive/archive_read_support_format_mtree.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/libarchive/archive_read_support_format_mtree.c b/lib/libarchive/archive_read_support_format_mtree.c
index 95094ae..5efe4a8 100644
--- a/lib/libarchive/archive_read_support_format_mtree.c
+++ b/lib/libarchive/archive_read_support_format_mtree.c
@@ -196,7 +196,7 @@ mtree_bid(struct archive_read *a)
return (-1);
if (strncmp(p, signature, strlen(signature)) == 0)
- return (8 * strlen(signature));
+ return (8 * (int)strlen(signature));
return (0);
}
@@ -398,7 +398,6 @@ read_mtree(struct archive_read *a, struct mtree *mtree)
global = NULL;
last_entry = NULL;
- r = ARCHIVE_OK;
for (counter = 1; ; ++counter) {
len = readline(a, mtree, &p, 256);
@@ -588,8 +587,7 @@ parse_file(struct archive_read *a, struct archive_entry *entry,
if (archive_entry_filetype(entry) == AE_IFREG ||
archive_entry_filetype(entry) == AE_IFDIR) {
- mtree->fd = open(path,
- O_RDONLY | O_BINARY);
+ mtree->fd = open(path, O_RDONLY | O_BINARY);
if (mtree->fd == -1 &&
(errno != ENOENT ||
archive_strlen(&mtree->contents_name) > 0)) {
@@ -1038,11 +1036,7 @@ parse_escapes(char *src, struct mtree_entry *mentry)
char *dest = src;
char c;
- /*
- * The current directory is somewhat special, it should be archived
- * only once as it will confuse extraction otherwise.
- */
- if (strcmp(src, ".") == 0)
+ if (mentry != NULL && strcmp(src, ".") == 0)
mentry->full = 1;
while (*src != '\0') {
@@ -1161,7 +1155,7 @@ mtree_atol10(char **p)
digit = **p - '0';
while (digit >= 0 && digit < base) {
if (l > limit || (l == limit && digit > last_digit_limit)) {
- l = UINT64_MAX; /* Truncate on overflow. */
+ l = INT64_MAX; /* Truncate on overflow. */
break;
}
l = (l * base) + digit;
@@ -1202,7 +1196,7 @@ mtree_atol16(char **p)
digit = -1;
while (digit >= 0 && digit < base) {
if (l > limit || (l == limit && digit > last_digit_limit)) {
- l = UINT64_MAX; /* Truncate on overflow. */
+ l = INT64_MAX; /* Truncate on overflow. */
break;
}
l = (l * base) + digit;
OpenPOWER on IntegriCloud