Deleted Added
full compact
read.c (276774) read.c (281311)
1/*-
2 * Copyright (c) 2007 Kai Wang
3 * Copyright (c) 2007 Tim Kientzle
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007 Kai Wang
3 * Copyright (c) 2007 Tim Kientzle
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/usr.bin/ar/read.c 276774 2015-01-07 01:51:02Z emaste $");
29__FBSDID("$FreeBSD: head/usr.bin/ar/read.c 281311 2015-04-09 13:45:17Z emaste $");
30
31#include <sys/queue.h>
32#include <sys/stat.h>
33#include <archive.h>
34#include <archive_entry.h>
35#include <errno.h>
36#include <libgen.h>
37#include <stdio.h>

--- 144 unchanged lines hidden (view full) ---

182 if (bsdar->options & AR_U &&
183 archive_entry_mtime(entry) <=
184 sb.st_mtime)
185 continue;
186 }
187
188 if (bsdar->options & AR_V)
189 (void)fprintf(stdout, "x - %s\n", name);
30
31#include <sys/queue.h>
32#include <sys/stat.h>
33#include <archive.h>
34#include <archive_entry.h>
35#include <errno.h>
36#include <libgen.h>
37#include <stdio.h>

--- 144 unchanged lines hidden (view full) ---

182 if (bsdar->options & AR_U &&
183 archive_entry_mtime(entry) <=
184 sb.st_mtime)
185 continue;
186 }
187
188 if (bsdar->options & AR_V)
189 (void)fprintf(stdout, "x - %s\n", name);
190 flags = 0;
190 /* Disallow absolute paths. */
191 if (name[0] == '/') {
192 bsdar_warnc(bsdar, 0,
193 "Absolute path '%s'", name);
194 continue;
195 }
196 /* Basic path security flags. */
197 flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS | \
198 ARCHIVE_EXTRACT_SECURE_NODOTDOT;
191 if (bsdar->options & AR_O)
192 flags |= ARCHIVE_EXTRACT_TIME;
193
194 r = archive_read_extract(a, entry, flags);
195 }
196
197 if (r)
198 bsdar_warnc(bsdar, 0, "%s",
199 archive_error_string(a));
200 }
201 }
202 AC(archive_read_close(a));
203 AC(archive_read_free(a));
204}
199 if (bsdar->options & AR_O)
200 flags |= ARCHIVE_EXTRACT_TIME;
201
202 r = archive_read_extract(a, entry, flags);
203 }
204
205 if (r)
206 bsdar_warnc(bsdar, 0, "%s",
207 archive_error_string(a));
208 }
209 }
210 AC(archive_read_close(a));
211 AC(archive_read_free(a));
212}