|
Last change
on this file since 3748 was 3621, checked in by Bruno Cornec, 9 years ago |
|
New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.
|
-
Property svn:eol-style
set to
native
|
|
File size:
632 bytes
|
| Line | |
|---|
| 1 | /* vi: set sw=4 ts=4: */
|
|---|
| 2 | /*
|
|---|
| 3 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #include "libbb.h"
|
|---|
| 7 | #include "bb_archive.h"
|
|---|
| 8 |
|
|---|
| 9 | const char* FAST_FUNC strip_unsafe_prefix(const char *str)
|
|---|
| 10 | {
|
|---|
| 11 | const char *cp = str;
|
|---|
| 12 | while (1) {
|
|---|
| 13 | char *cp2;
|
|---|
| 14 | if (*cp == '/') {
|
|---|
| 15 | cp++;
|
|---|
| 16 | continue;
|
|---|
| 17 | }
|
|---|
| 18 | if (is_prefixed_with(cp, "/../"+1)) {
|
|---|
| 19 | cp += 3;
|
|---|
| 20 | continue;
|
|---|
| 21 | }
|
|---|
| 22 | cp2 = strstr(cp, "/../");
|
|---|
| 23 | if (!cp2)
|
|---|
| 24 | break;
|
|---|
| 25 | cp = cp2 + 4;
|
|---|
| 26 | }
|
|---|
| 27 | if (cp != str) {
|
|---|
| 28 | static smallint warned = 0;
|
|---|
| 29 | if (!warned) {
|
|---|
| 30 | warned = 1;
|
|---|
| 31 | bb_error_msg("removing leading '%.*s' from member names",
|
|---|
| 32 | (int)(cp - str), str);
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 | return cp;
|
|---|
| 36 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.