Merge two cpio fixes from libarchive.googlecode.com:
1) Avoid an infinite loop in the header resync for certain malformed archives. 2) Don't try to match hardlinks if the nlinks count is < 2. This reduces the likelihood of a false hardlink match due to ino truncation. MFC after: 7 days
This commit is contained in:
parent
72bc4ff74d
commit
30a9ca8e26
@ -356,7 +356,7 @@ find_newc_header(struct archive_read *a)
|
||||
* Scan ahead until we find something that looks
|
||||
* like an odc header.
|
||||
*/
|
||||
while (p + sizeof(struct cpio_newc_header) < q) {
|
||||
while (p + sizeof(struct cpio_newc_header) <= q) {
|
||||
switch (p[5]) {
|
||||
case '1':
|
||||
case '2':
|
||||
@ -490,7 +490,7 @@ find_odc_header(struct archive_read *a)
|
||||
* Scan ahead until we find something that looks
|
||||
* like an odc header.
|
||||
*/
|
||||
while (p + sizeof(struct cpio_odc_header) < q) {
|
||||
while (p + sizeof(struct cpio_odc_header) <= q) {
|
||||
switch (p[5]) {
|
||||
case '7':
|
||||
if (memcmp("070707", p, 6) == 0
|
||||
@ -731,6 +731,9 @@ record_hardlink(struct cpio *cpio, struct archive_entry *entry)
|
||||
dev_t dev;
|
||||
ino_t ino;
|
||||
|
||||
if (archive_entry_nlink(entry) <= 1)
|
||||
return;
|
||||
|
||||
dev = archive_entry_dev(entry);
|
||||
ino = archive_entry_ino(entry);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user