Lines 2298-2305
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
Link Here
|
2298 |
/* PR binutils/17533: Do not allow directory traversal |
2298 |
/* PR binutils/17533: Do not allow directory traversal |
2299 |
outside of the current directory tree by archive members. */ |
2299 |
outside of the current directory tree by archive members. */ |
2300 |
if (! is_valid_archive_path (bfd_get_filename (this_element))) |
2300 |
if (! is_valid_archive_path (bfd_get_filename (this_element))) |
2301 |
fatal (_("illegal pathname found in archive member: %s"), |
2301 |
{ |
2302 |
bfd_get_filename (this_element)); |
2302 |
non_fatal (_("illegal pathname found in archive member: %s"), |
|
|
2303 |
bfd_get_filename (this_element)); |
2304 |
status = 1; |
2305 |
goto cleanup_and_exit; |
2306 |
} |
2303 |
|
2307 |
|
2304 |
/* Create an output file for this member. */ |
2308 |
/* Create an output file for this member. */ |
2305 |
output_name = concat (dir, "/", |
2309 |
output_name = concat (dir, "/", |
Lines 2310-2317
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
Link Here
|
2310 |
{ |
2314 |
{ |
2311 |
output_name = make_tempdir (output_name); |
2315 |
output_name = make_tempdir (output_name); |
2312 |
if (output_name == NULL) |
2316 |
if (output_name == NULL) |
2313 |
fatal (_("cannot create tempdir for archive copying (error: %s)"), |
2317 |
{ |
2314 |
strerror (errno)); |
2318 |
non_fatal (_("cannot create tempdir for archive copying (error: %s)"), |
|
|
2319 |
strerror (errno)); |
2320 |
status = 1; |
2321 |
goto cleanup_and_exit; |
2322 |
} |
2315 |
|
2323 |
|
2316 |
l = (struct name_list *) xmalloc (sizeof (struct name_list)); |
2324 |
l = (struct name_list *) xmalloc (sizeof (struct name_list)); |
2317 |
l->name = output_name; |
2325 |
l->name = output_name; |
Lines 2353-2359
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
Link Here
|
2353 |
{ |
2361 |
{ |
2354 |
bfd_nonfatal_message (output_name, NULL, NULL, NULL); |
2362 |
bfd_nonfatal_message (output_name, NULL, NULL, NULL); |
2355 |
status = 1; |
2363 |
status = 1; |
2356 |
return; |
2364 |
goto cleanup_and_exit; |
2357 |
} |
2365 |
} |
2358 |
|
2366 |
|
2359 |
if (ok_object) |
2367 |
if (ok_object) |
Lines 2414-2420
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
Link Here
|
2414 |
{ |
2422 |
{ |
2415 |
status = 1; |
2423 |
status = 1; |
2416 |
bfd_nonfatal_message (filename, NULL, NULL, NULL); |
2424 |
bfd_nonfatal_message (filename, NULL, NULL, NULL); |
2417 |
return; |
|
|
2418 |
} |
2425 |
} |
2419 |
|
2426 |
|
2420 |
filename = bfd_get_filename (ibfd); |
2427 |
filename = bfd_get_filename (ibfd); |
Lines 2422-2430
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
Link Here
|
2422 |
{ |
2429 |
{ |
2423 |
status = 1; |
2430 |
status = 1; |
2424 |
bfd_nonfatal_message (filename, NULL, NULL, NULL); |
2431 |
bfd_nonfatal_message (filename, NULL, NULL, NULL); |
2425 |
return; |
|
|
2426 |
} |
2432 |
} |
2427 |
|
2433 |
|
|
|
2434 |
cleanup_and_exit: |
2428 |
/* Delete all the files that we opened. */ |
2435 |
/* Delete all the files that we opened. */ |
2429 |
for (l = list; l != NULL; l = l->next) |
2436 |
for (l = list; l != NULL; l = l->next) |
2430 |
{ |
2437 |
{ |