Rev 5217 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5217 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* bucomm.c -- Bin Utils COMmon code. |
1 | /* bucomm.c -- Bin Utils COMmon code. |
2 | Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002, |
- | |
3 | 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
- | |
4 | Free Software Foundation, Inc. |
2 | Copyright (C) 1991-2015 Free Software Foundation, Inc. |
Line 5... | Line 3... | ||
5 | 3 | ||
Line 6... | Line 4... | ||
6 | This file is part of GNU Binutils. |
4 | This file is part of GNU Binutils. |
7 | 5 | ||
Line 125... | Line 123... | ||
125 | vfprintf (stderr, format, args); |
123 | vfprintf (stderr, format, args); |
126 | putc ('\n', stderr); |
124 | putc ('\n', stderr); |
127 | } |
125 | } |
Line 128... | Line 126... | ||
128 | 126 | ||
129 | void |
127 | void |
130 | fatal VPARAMS ((const char *format, ...)) |
128 | fatal (const char *format, ...) |
131 | { |
129 | { |
- | 130 | va_list args; |
|
132 | VA_OPEN (args, format); |
131 | |
Line 133... | Line 132... | ||
133 | VA_FIXEDARG (args, const char *, format); |
132 | va_start (args, format); |
134 | 133 | ||
135 | report (format, args); |
134 | report (format, args); |
136 | VA_CLOSE (args); |
135 | va_end (args); |
Line 137... | Line 136... | ||
137 | xexit (1); |
136 | xexit (1); |
138 | } |
137 | } |
139 | 138 | ||
140 | void |
139 | void |
- | 140 | non_fatal (const char *format, ...) |
|
141 | non_fatal VPARAMS ((const char *format, ...)) |
141 | { |
Line 142... | Line 142... | ||
142 | { |
142 | va_list args; |
143 | VA_OPEN (args, format); |
143 | |
144 | VA_FIXEDARG (args, const char *, format); |
144 | va_start (args, format); |
Line 145... | Line 145... | ||
145 | 145 | ||
146 | report (format, args); |
146 | report (format, args); |
147 | VA_CLOSE (args); |
147 | va_end (args); |
Line 427... | Line 427... | ||
427 | char timebuf[40]; |
427 | char timebuf[40]; |
428 | time_t when = buf.st_mtime; |
428 | time_t when = buf.st_mtime; |
429 | const char *ctime_result = (const char *) ctime (&when); |
429 | const char *ctime_result = (const char *) ctime (&when); |
430 | bfd_size_type size; |
430 | bfd_size_type size; |
Line -... | Line 431... | ||
- | 431 | ||
- | 432 | /* PR binutils/17605: Check for corrupt time values. */ |
|
- | 433 | if (ctime_result == NULL) |
|
- | 434 | sprintf (timebuf, _(" |
|
431 | 435 | else |
|
432 | /* POSIX format: skip weekday and seconds from ctime output. */ |
436 | /* POSIX format: skip weekday and seconds from ctime output. */ |
Line 433... | Line 437... | ||
433 | sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20); |
437 | sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20); |
434 | 438 | ||
Line 625... | Line 629... | ||
625 | } |
629 | } |
626 | sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), |
630 | sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), |
627 | bfd_get_filename (abfd)); |
631 | bfd_get_filename (abfd)); |
628 | return buf; |
632 | return buf; |
629 | }>>>>>>> |
633 | } |
- | 634 | ||
- | 635 | /* Returns TRUE iff PATHNAME, a filename of an archive member, |
|
- | 636 | is valid for writing. For security reasons absolute paths |
|
- | 637 | and paths containing /../ are not allowed. See PR 17533. */ |
|
- | 638 | ||
- | 639 | bfd_boolean |
|
- | 640 | is_valid_archive_path (char const * pathname) |
|
- | 641 | { |
|
- | 642 | const char * n = pathname; |
|
- | 643 | ||
- | 644 | if (IS_ABSOLUTE_PATH (n)) |
|
- | 645 | return FALSE; |
|
- | 646 | ||
- | 647 | while (*n) |
|
- | 648 | { |
|
- | 649 | if (*n == '.' && *++n == '.' && ( ! *++n || IS_DIR_SEPARATOR (*n))) |
|
- | 650 | return FALSE; |
|
- | 651 | ||
- | 652 | while (*n && ! IS_DIR_SEPARATOR (*n)) |
|
- | 653 | n++; |
|
- | 654 | while (IS_DIR_SEPARATOR (*n)) |
|
- | 655 | n++; |
|
- | 656 | } |
|
- | 657 | ||
- | 658 | return TRUE; |
|
- | 659 | }>>>>>>> |