View | Details | Raw Unified | Return to bug 282047 | Differences between
and this patch

Collapse All | Expand All

(-)b/contrib/libarchive/NEWS (+6 lines)
Lines 1-3 Link Here
1
Oct 13, 2024: libarchive 3.7.7 released
2
3
Sep 23, 2024: libarchive 3.7.6 released
4
5
Sep 13, 2024: libarchive 3.7.5 released
6
1
Apr 26, 2024: libarchive 3.7.4 released
7
Apr 26, 2024: libarchive 3.7.4 released
2
8
3
Apr 08, 2024: libarchive 3.7.3 released
9
Apr 08, 2024: libarchive 3.7.3 released
(-)b/contrib/libarchive/cat/bsdcat.1 (-22 / +4 lines)
Lines 1-26 Link Here
1
.\" Copyright (c) 2011-2014, Mike Kazantsev
2
.\" All rights reserved.
3
.\"
1
.\"
4
.\" Redistribution and use in source and binary forms, with or without
2
.\" SPDX-License-Identifier: BSD-2-Clause
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\"
3
.\"
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
4
.\" Copyright (c) 2011-2014, Mike Kazantsev
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5
.\" All rights reserved.
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
.\" SUCH DAMAGE.
24
.\"
6
.\"
25
.Dd March 1, 2014
7
.Dd March 1, 2014
26
.Dt BSDCAT 1
8
.Dt BSDCAT 1
Lines 39-45 expands files to standard output. Link Here
39
.Nm
21
.Nm
40
typically takes a filename as an argument or reads standard input when used in a
22
typically takes a filename as an argument or reads standard input when used in a
41
pipe.
23
pipe.
42
In both cases decompressed data it written to standard output.
24
In both cases decompressed data is written to standard output.
43
.Sh EXAMPLES
25
.Sh EXAMPLES
44
To decompress a file:
26
To decompress a file:
45
.Pp
27
.Pp
(-)b/contrib/libarchive/cat/bsdcat.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2011-2014, Mike Kazantsev
4
 * Copyright (c) 2011-2014, Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#include "bsdcat_platform.h"
8
#include "bsdcat_platform.h"
(-)b/contrib/libarchive/cat/bsdcat.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014, Mike Kazantsev
4
 * Copyright (c) 2014, Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#ifndef BSDCAT_H_INCLUDED
8
#ifndef BSDCAT_H_INCLUDED
(-)b/contrib/libarchive/cat/bsdcat_platform.h (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
Lines 58-64 Link Here
58
#define __LA_NORETURN       __attribute__((__noreturn__))
40
#define __LA_NORETURN       __attribute__((__noreturn__))
59
#elif defined(_MSC_VER)
41
#elif defined(_MSC_VER)
60
#define __LA_NORETURN __declspec(noreturn)
42
#define __LA_NORETURN __declspec(noreturn)
61
#else 
43
#else
62
#define __LA_NORETURN
44
#define __LA_NORETURN
63
#endif
45
#endif
64
46
(-)b/contrib/libarchive/cat/cmdline.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
(-)b/contrib/libarchive/cat/test/test.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2006 Tim Kientzle
4
 * Copyright (c) 2003-2006 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/* Every test program should #include "test.h" as the first thing. */
8
/* Every test program should #include "test.h" as the first thing. */
(-)b/contrib/libarchive/cat/test/test_0.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_empty_gz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Sebastian Freundt
4
 * Copyright (c) 2014 Sebastian Freundt
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_empty_lz4.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Sebastian Freundt
4
 * Copyright (c) 2014 Sebastian Freundt
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_empty_xz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Sebastian Freundt
4
 * Copyright (c) 2014 Sebastian Freundt
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_empty_zstd.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_error.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_error_mixed.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_expand_Z.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_expand_bz2.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cat/test/test_expand_gz.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cat/test/test_expand_lz4.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * Copyright (c) 2012, 2014 Michihiro NAKAJIMA
5
 * Copyright (c) 2012, 2014 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cat/test/test_expand_mixed.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_expand_plain.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_expand_xz.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Mike Kazantsev
4
 * Copyright (c) 2014 Mike Kazantsev
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cat/test/test_expand_zstd.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_help.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_stdin.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cat/test/test_version.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/bsdcpio.1 (-21 / +3 lines)
Lines 1-26 Link Here
1
.\" Copyright (c) 2003-2007 Tim Kientzle
2
.\" All rights reserved.
3
.\"
1
.\"
4
.\" Redistribution and use in source and binary forms, with or without
2
.\" SPDX-License-Identifier: BSD-2-Clause
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\"
3
.\"
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
4
.\" Copyright (c) 2003-2007 Tim Kientzle
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5
.\" All rights reserved.
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
.\" SUCH DAMAGE.
24
.\"
6
.\"
25
.Dd September 16, 2014
7
.Dd September 16, 2014
26
.Dt CPIO 1
8
.Dt CPIO 1
(-)b/contrib/libarchive/cpio/cmdline.c (-37 / +39 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
7
27
8
Lines 308-324 cpio_getopt(struct cpio *cpio) Link Here
308
 * Returns NULL if no error, otherwise returns error string for display.
289
 * Returns NULL if no error, otherwise returns error string for display.
309
 *
290
 *
310
 */
291
 */
311
const char *
292
int
312
owner_parse(const char *spec, int *uid, int *gid)
293
owner_parse(const char *spec, struct cpio_owner *owner, const char **errmsg)
313
{
294
{
314
	static char errbuff[128];
295
	static char errbuff[128];
315
	const char *u, *ue, *g;
296
	const char *u, *ue, *g;
316
297
317
	*uid = -1;
298
	owner->uid = -1;
318
	*gid = -1;
299
	owner->gid = -1;
319
300
320
	if (spec[0] == '\0')
301
	owner->uname = NULL;
321
		return ("Invalid empty user/group spec");
302
	owner->gname = NULL;
303
304
	if (spec[0] == '\0') {
305
		*errmsg = "Invalid empty user/group spec";
306
		return (-1);
307
	}
322
308
323
	/*
309
	/*
324
	 * Split spec into [user][:.][group]
310
	 * Split spec into [user][:.][group]
Lines 345-369 owner_parse(const char *spec, int *uid, int *gid) Link Here
345
		char *user;
331
		char *user;
346
		struct passwd *pwent;
332
		struct passwd *pwent;
347
333
348
		user = (char *)malloc(ue - u + 1);
334
		user = malloc(ue - u + 1);
349
		if (user == NULL)
335
		if (user == NULL)
350
			return ("Couldn't allocate memory");
336
			goto alloc_error;
351
		memcpy(user, u, ue - u);
337
		memcpy(user, u, ue - u);
352
		user[ue - u] = '\0';
338
		user[ue - u] = '\0';
353
		if ((pwent = getpwnam(user)) != NULL) {
339
		if ((pwent = getpwnam(user)) != NULL) {
354
			*uid = pwent->pw_uid;
340
			owner->uid = pwent->pw_uid;
341
			owner->uname = strdup(pwent->pw_name);
342
			if (owner->uname == NULL) {
343
				free(user);
344
				goto alloc_error;
345
			}
355
			if (*ue != '\0')
346
			if (*ue != '\0')
356
				*gid = pwent->pw_gid;
347
				owner->gid = pwent->pw_gid;
357
		} else {
348
		} else {
358
			char *end;
349
			char *end;
359
			errno = 0;
350
			errno = 0;
360
			*uid = (int)strtoul(user, &end, 10);
351
			owner->uid = (int)strtoul(user, &end, 10);
361
			if (errno || *end != '\0') {
352
			if (errno || *end != '\0') {
362
				snprintf(errbuff, sizeof(errbuff),
353
				snprintf(errbuff, sizeof(errbuff),
363
				    "Couldn't lookup user ``%s''", user);
354
				    "Couldn't lookup user ``%s''", user);
364
				errbuff[sizeof(errbuff) - 1] = '\0';
355
				errbuff[sizeof(errbuff) - 1] = '\0';
365
				free(user);
356
				free(user);
366
				return (errbuff);
357
				*errmsg = errbuff;
358
				return (-1);
367
			}
359
			}
368
		}
360
		}
369
		free(user);
361
		free(user);
Lines 372-389 owner_parse(const char *spec, int *uid, int *gid) Link Here
372
	if (*g != '\0') {
364
	if (*g != '\0') {
373
		struct group *grp;
365
		struct group *grp;
374
		if ((grp = getgrnam(g)) != NULL) {
366
		if ((grp = getgrnam(g)) != NULL) {
375
			*gid = grp->gr_gid;
367
			owner->gid = grp->gr_gid;
368
			owner->gname = strdup(grp->gr_name);
369
			if (owner->gname == NULL) {
370
				free(owner->uname);
371
				owner->uname = NULL;
372
				goto alloc_error;
373
			}
376
		} else {
374
		} else {
377
			char *end;
375
			char *end;
378
			errno = 0;
376
			errno = 0;
379
			*gid = (int)strtoul(g, &end, 10);
377
			owner->gid = (int)strtoul(g, &end, 10);
380
			if (errno || *end != '\0') {
378
			if (errno || *end != '\0') {
381
				snprintf(errbuff, sizeof(errbuff),
379
				snprintf(errbuff, sizeof(errbuff),
382
				    "Couldn't lookup group ``%s''", g);
380
				    "Couldn't lookup group ``%s''", g);
383
				errbuff[sizeof(errbuff) - 1] = '\0';
381
				errbuff[sizeof(errbuff) - 1] = '\0';
384
				return (errbuff);
382
				*errmsg = errbuff;
383
				return (-1);
385
			}
384
			}
386
		}
385
		}
387
	}
386
	}
388
	return (NULL);
387
	return (0);
388
alloc_error:
389
	*errmsg = "Couldn't allocate memory";
390
	return (-1);
389
}
391
}
(-)b/contrib/libarchive/cpio/cpio.c (-39 / +31 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
7
27
8
Lines 132-140 main(int argc, char *argv[]) Link Here
132
	static char buff[16384];
113
	static char buff[16384];
133
	struct cpio _cpio; /* Allocated on stack. */
114
	struct cpio _cpio; /* Allocated on stack. */
134
	struct cpio *cpio;
115
	struct cpio *cpio;
116
	struct cpio_owner owner;
135
	const char *errmsg;
117
	const char *errmsg;
136
	char *tptr;
118
	char *tptr;
137
	int uid, gid;
138
	int opt, t;
119
	int opt, t;
139
120
140
	cpio = &_cpio;
121
	cpio = &_cpio;
Lines 142-147 main(int argc, char *argv[]) Link Here
142
	cpio->buff = buff;
123
	cpio->buff = buff;
143
	cpio->buff_size = sizeof(buff);
124
	cpio->buff_size = sizeof(buff);
144
125
126
145
#if defined(HAVE_SIGACTION) && defined(SIGPIPE)
127
#if defined(HAVE_SIGACTION) && defined(SIGPIPE)
146
	{ /* Ignore SIGPIPE signals. */
128
	{ /* Ignore SIGPIPE signals. */
147
		struct sigaction sa;
129
		struct sigaction sa;
Lines 161-167 main(int argc, char *argv[]) Link Here
161
#endif
143
#endif
162
144
163
	cpio->uid_override = -1;
145
	cpio->uid_override = -1;
146
	cpio->uname_override = NULL;
164
	cpio->gid_override = -1;
147
	cpio->gid_override = -1;
148
	cpio->gname_override = NULL;
165
	cpio->argv = argv;
149
	cpio->argv = argv;
166
	cpio->argc = argc;
150
	cpio->argc = argc;
167
	cpio->mode = '\0';
151
	cpio->mode = '\0';
Lines 320-340 main(int argc, char *argv[]) Link Here
320
			cpio->quiet = 1;
304
			cpio->quiet = 1;
321
			break;
305
			break;
322
		case 'R': /* GNU cpio, also --owner */
306
		case 'R': /* GNU cpio, also --owner */
323
			/* TODO: owner_parse should return uname/gname
307
			errmsg = NULL;
324
			 * also; use that to set [ug]name_override. */
308
			if (owner_parse(cpio->argument, &owner, &errmsg) != 0) {
325
			errmsg = owner_parse(cpio->argument, &uid, &gid);
309
				if (!errmsg)
326
			if (errmsg) {
310
					errmsg = "Error parsing owner";
327
				lafe_warnc(-1, "%s", errmsg);
311
				lafe_warnc(-1, "%s", errmsg);
328
				usage();
312
				usage();
329
			}
313
			}
330
			if (uid != -1) {
314
			if (owner.uid != -1)
331
				cpio->uid_override = uid;
315
				cpio->uid_override = owner.uid;
332
				cpio->uname_override = NULL;
316
			if (owner.uname != NULL)
333
			}
317
				cpio->uname_override = owner.uname;
334
			if (gid != -1) {
318
			if (owner.gid != -1)
335
				cpio->gid_override = gid;
319
				cpio->gid_override = owner.gid;
336
				cpio->gname_override = NULL;
320
			if (owner.gname != NULL)
337
			}
321
				cpio->gname_override = owner.gname;
338
			break;
322
			break;
339
		case 'r': /* POSIX 1997 */
323
		case 'r': /* POSIX 1997 */
340
			cpio->option_rename = 1;
324
			cpio->option_rename = 1;
Lines 439-449 main(int argc, char *argv[]) Link Here
439
	}
423
	}
440
424
441
	archive_match_free(cpio->matching);
425
	archive_match_free(cpio->matching);
442
	free_cache(cpio->gname_cache);
443
	free_cache(cpio->uname_cache);
426
	free_cache(cpio->uname_cache);
427
	free(cpio->uname_override);
428
	free_cache(cpio->gname_cache);
429
	free(cpio->gname_override);
444
	archive_read_close(cpio->archive_read_disk);
430
	archive_read_close(cpio->archive_read_disk);
445
	archive_read_free(cpio->archive_read_disk);
431
	archive_read_free(cpio->archive_read_disk);
446
	free(cpio->destdir);
432
	free(cpio->destdir);
433
447
	passphrase_free(cpio->ppbuff);
434
	passphrase_free(cpio->ppbuff);
448
	return (cpio->return_value);
435
	return (cpio->return_value);
449
}
436
}
Lines 728-741 file_to_archive(struct cpio *cpio, const char *srcpath) Link Here
728
		return (r);
715
		return (r);
729
	}
716
	}
730
717
731
	if (cpio->uid_override >= 0) {
718
	if (cpio->uid_override >= 0)
732
		archive_entry_set_uid(entry, cpio->uid_override);
719
		archive_entry_set_uid(entry, cpio->uid_override);
720
	if (cpio->gname_override != NULL)
733
		archive_entry_set_uname(entry, cpio->uname_override);
721
		archive_entry_set_uname(entry, cpio->uname_override);
734
	}
722
	if (cpio->gid_override >= 0)
735
	if (cpio->gid_override >= 0) {
736
		archive_entry_set_gid(entry, cpio->gid_override);
723
		archive_entry_set_gid(entry, cpio->gid_override);
724
	if (cpio->gname_override != NULL)
737
		archive_entry_set_gname(entry, cpio->gname_override);
725
		archive_entry_set_gname(entry, cpio->gname_override);
738
	}
739
726
740
	/*
727
	/*
741
	 * Generate a destination path for this entry.
728
	 * Generate a destination path for this entry.
Lines 1015-1027 mode_in(struct cpio *cpio) Link Here
1015
			fprintf(stderr, ".");
1002
			fprintf(stderr, ".");
1016
		if (cpio->uid_override >= 0)
1003
		if (cpio->uid_override >= 0)
1017
			archive_entry_set_uid(entry, cpio->uid_override);
1004
			archive_entry_set_uid(entry, cpio->uid_override);
1005
		if (cpio->uname_override != NULL)
1006
			archive_entry_set_uname(entry, cpio->uname_override);
1018
		if (cpio->gid_override >= 0)
1007
		if (cpio->gid_override >= 0)
1019
			archive_entry_set_gid(entry, cpio->gid_override);
1008
			archive_entry_set_gid(entry, cpio->gid_override);
1009
		if (cpio->gname_override != NULL)
1010
			archive_entry_set_gname(entry, cpio->gname_override);
1020
		r = archive_write_header(ext, entry);
1011
		r = archive_write_header(ext, entry);
1021
		if (r != ARCHIVE_OK) {
1012
		if (r != ARCHIVE_OK) {
1022
			fprintf(stderr, "%s: %s\n",
1013
			fprintf(stderr, "%s: %s\n",
1023
			    archive_entry_pathname(entry),
1014
			    archive_entry_pathname(entry),
1024
			    archive_error_string(ext));
1015
			    archive_error_string(ext));
1016
			cpio->return_value = 1;
1025
		} else if (!archive_entry_size_is_set(entry)
1017
		} else if (!archive_entry_size_is_set(entry)
1026
		    || archive_entry_size(entry) > 0) {
1018
		    || archive_entry_size(entry) > 0) {
1027
			r = extract_data(a, ext);
1019
			r = extract_data(a, ext);
(-)b/contrib/libarchive/cpio/cpio.h (-21 / +9 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#ifndef CPIO_H_INCLUDED
8
#ifndef CPIO_H_INCLUDED
Lines 94-101 struct cpio { Link Here
94
	char		 *ppbuff;
76
	char		 *ppbuff;
95
};
77
};
96
78
97
const char *owner_parse(const char *, int *, int *);
79
struct cpio_owner {
80
        int uid;
81
        int gid;
82
        char *uname;
83
        char *gname;
84
};
98
85
86
int owner_parse(const char *, struct cpio_owner *, const char **);
99
87
100
/* Fake short equivalents for long options that otherwise lack them. */
88
/* Fake short equivalents for long options that otherwise lack them. */
101
enum {
89
enum {
(-)b/contrib/libarchive/cpio/cpio_platform.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
(-)b/contrib/libarchive/cpio/test/test.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/* Every test program should #include "test.h" as the first thing. */
8
/* Every test program should #include "test.h" as the first thing. */
(-)b/contrib/libarchive/cpio/test/test_0.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_basic.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_cmdline.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2009 Tim Kientzle
4
 * Copyright (c) 2003-2009 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_Z.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_absolute_paths.c (+53 lines)
Added Link Here
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
4
 * Copyright (c) 2024 Mostyn Bramley-Moore <mostyn@antipode.se>
5
 */
6
7
#include "test.h"
8
9
#include <stdlib.h>
10
#include <string.h>
11
12
#if defined(_WIN32) && !defined(__CYGWIN__)
13
#define UNLINK _unlink
14
#else
15
#define UNLINK unlink
16
#endif
17
18
DEFINE_TEST(test_extract_cpio_absolute_paths)
19
{
20
	int r;
21
22
	// Create an absolute path for a test file inside testworkdir.
23
	const char *entry_suffix = "/cpio-noabs";
24
	size_t entry_suffix_length = strlen(entry_suffix);
25
	size_t testworkdir_length = strlen(testworkdir);
26
	size_t temp_absolute_file_name_length = testworkdir_length + entry_suffix_length;
27
	char *temp_absolute_file_name = calloc(1, temp_absolute_file_name_length + 1); // +1 for null character.
28
	assertEqualInt(snprintf(temp_absolute_file_name, temp_absolute_file_name_length + 1, "%s%s", testworkdir, entry_suffix),
29
		temp_absolute_file_name_length);
30
31
	// Create the file.
32
	const char *sample_data = "test file from test_extract_cpio_absolute_paths";
33
	assertMakeFile(temp_absolute_file_name, 0644, sample_data);
34
35
	// Create an archive with the test file, using an absolute path.
36
	assertMakeFile("filelist", 0644, temp_absolute_file_name);
37
	r = systemf("%s -o < filelist > archive.cpio 2> stderr1.txt", testprog);
38
	assertEqualInt(r, 0);
39
40
	// Ensure that the temp file does not exist.
41
	UNLINK(temp_absolute_file_name);
42
43
	// We should refuse to create the absolute path without --insecure.
44
	r = systemf("%s -i < archive.cpio 2> stderr2.txt", testprog);
45
	assert(r != 0);
46
	assertFileNotExists(temp_absolute_file_name);
47
	UNLINK(temp_absolute_file_name); // Cleanup just in case.
48
49
	// But if we specify --insecure then the absolute path should be created.
50
	r = systemf("%s -i --insecure < archive.cpio 2> stderr3.txt", testprog);
51
	assert(r == 0);
52
	assertFileExists(temp_absolute_file_name);
53
}
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_bz2.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_grz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_gz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_lrz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_lz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_lz4.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012,2014 Michihiro NAKAJIMA
4
 * Copyright (c) 2012,2014 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_lzma.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_lzo.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_xz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_extract_cpio_zstd.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_format_newc.c (-23 / +5 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 194-204 DEFINE_TEST(test_format_newc) Link Here
194
	assertEqualMem(e + 0, "070701", 6); /* Magic */
176
	assertEqualMem(e + 0, "070701", 6); /* Magic */
195
	ino = from_hex(e + 6, 8); /* ino */
177
	ino = from_hex(e + 6, 8); /* ino */
196
#if defined(_WIN32) && !defined(__CYGWIN__)
178
#if defined(_WIN32) && !defined(__CYGWIN__)
197
	/* Group members bits and others bits do not work. */ 
179
	/* Group members bits and others bits do not work. */
198
	assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
180
	assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
199
#else
181
#else
200
	assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
182
	assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
201
#endif	
183
#endif
202
#if defined(_WIN32)
184
#if defined(_WIN32)
203
	uid = from_hex(e + 22, 8);
185
	uid = from_hex(e + 22, 8);
204
#else
186
#else
Lines 308-314 DEFINE_TEST(test_format_newc) Link Here
308
	failure("If these aren't the same, then the hardlink detection failed to match them.");
290
	failure("If these aren't the same, then the hardlink detection failed to match them.");
309
	assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */
291
	assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */
310
#if defined(_WIN32) && !defined(__CYGWIN__)
292
#if defined(_WIN32) && !defined(__CYGWIN__)
311
	/* Group members bits and others bits do not work. */ 
293
	/* Group members bits and others bits do not work. */
312
	assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
294
	assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
313
#else
295
#else
314
	assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
296
	assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
(-)b/contrib/libarchive/cpio/test/test_gcpio_compat.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_missing_file.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2016 Tim Kientzle
4
 * Copyright (c) 2016 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_0.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2010 Tim Kientzle
4
 * Copyright (c) 2003-2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_B_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_C_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_J_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2009 Tim Kientzle
4
 * Copyright (c) 2003-2009 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_L_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_Z_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2009 Tim Kientzle
4
 * Copyright (c) 2003-2009 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_a.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
#if defined(HAVE_UTIME_H)
8
#if defined(HAVE_UTIME_H)
(-)b/contrib/libarchive/cpio/test/test_option_b64encode.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cpio/test/test_option_c.c (-24 / +6 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 119-127 DEFINE_TEST(test_option_c) Link Here
119
	assert(is_octal(e, 76)); /* Entire header is octal digits. */
101
	assert(is_octal(e, 76)); /* Entire header is octal digits. */
120
	assertEqualMem(e + 0, "070707", 6); /* Magic */
102
	assertEqualMem(e + 0, "070707", 6); /* Magic */
121
	assert(is_octal(e + 6, 6)); /* dev */
103
	assert(is_octal(e + 6, 6)); /* dev */
122
	dev = from_octal(e + 6, 6);
104
	dev = (int)from_octal(e + 6, 6);
123
	assert(is_octal(e + 12, 6)); /* ino */
105
	assert(is_octal(e + 12, 6)); /* ino */
124
	ino = from_octal(e + 12, 6);
106
	ino = (int)from_octal(e + 12, 6);
125
#if defined(_WIN32) && !defined(__CYGWIN__)
107
#if defined(_WIN32) && !defined(__CYGWIN__)
126
	/* Group members bits and others bits do not work. */
108
	/* Group members bits and others bits do not work. */
127
	assertEqualMem(e + 18, "100666", 6); /* Mode */
109
	assertEqualMem(e + 18, "100666", 6); /* Mode */
Lines 129-138 DEFINE_TEST(test_option_c) Link Here
129
	assertEqualMem(e + 18, "100644", 6); /* Mode */
111
	assertEqualMem(e + 18, "100644", 6); /* Mode */
130
#endif
112
#endif
131
	if (uid < 0)
113
	if (uid < 0)
132
		uid = from_octal(e + 24, 6);
114
		uid = (int)from_octal(e + 24, 6);
133
	assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
115
	assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
134
	assert(is_octal(e + 30, 6)); /* gid */
116
	assert(is_octal(e + 30, 6)); /* gid */
135
	gid = from_octal(e + 30, 6);
117
	gid = (int)from_octal(e + 30, 6);
136
	assertEqualMem(e + 36, "000001", 6); /* nlink */
118
	assertEqualMem(e + 36, "000001", 6); /* nlink */
137
	failure("file entries should not have rdev set (dev field was 0%o)",
119
	failure("file entries should not have rdev set (dev field was 0%o)",
138
	    dev);
120
	    dev);
(-)b/contrib/libarchive/cpio/test/test_option_d.c (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 44-50 DEFINE_TEST(test_option_d) Link Here
44
	assertMakeDir("without-d", 0755);
26
	assertMakeDir("without-d", 0755);
45
	assertChdir("without-d");
27
	assertChdir("without-d");
46
	r = systemf("%s -i < ../archive.cpio >out 2>err", testprog);
28
	r = systemf("%s -i < ../archive.cpio >out 2>err", testprog);
47
	assertEqualInt(r, 0);
29
	assert(r != 0);
48
	assertEmptyFile("out");
30
	assertEmptyFile("out");
49
	/* And the file should not be restored. */
31
	/* And the file should not be restored. */
50
	assertFileNotExists("dir/file");
32
	assertFileNotExists("dir/file");
(-)b/contrib/libarchive/cpio/test/test_option_f.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_grzip.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cpio/test/test_option_help.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_l.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_lrzip.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cpio/test/test_option_lz4.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Michihiro NAKAJIMA
4
 * Copyright (c) 2014 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_lzma.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_lzop.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cpio/test/test_option_m.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_passphrase.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Michihiro NAKAJIMA
4
 * Copyright (c) 2014 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_t.c (-23 / +6 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 33-39 DEFINE_TEST(test_option_t) Link Here
33
	char *p;
15
	char *p;
34
	int r;
16
	int r;
35
	time_t mtime;
17
	time_t mtime;
36
	char date[32];
18
	char date[48];
37
	char date2[32];
19
	char date2[32];
38
	struct tm *tmptr;
20
	struct tm *tmptr;
39
#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
21
#if defined(HAVE_LOCALTIME_R) || defined(HAVE_LOCALTIME_S)
Lines 89-94 DEFINE_TEST(test_option_t) Link Here
89
	mtime = 1;
71
	mtime = 1;
90
#ifdef HAVE_LOCALE_H
72
#ifdef HAVE_LOCALE_H
91
	setlocale(LC_ALL, "");
73
	setlocale(LC_ALL, "");
74
	setlocale(LC_TIME, "");
92
#endif
75
#endif
93
#if defined(HAVE_LOCALTIME_S)
76
#if defined(HAVE_LOCALTIME_S)
94
        tmptr = localtime_s(&tmbuf, &mtime) ? NULL : &tmbuf;
77
        tmptr = localtime_s(&tmbuf, &mtime) ? NULL : &tmbuf;
Lines 99-108 DEFINE_TEST(test_option_t) Link Here
99
#endif
82
#endif
100
#if defined(_WIN32) && !defined(__CYGWIN__)
83
#if defined(_WIN32) && !defined(__CYGWIN__)
101
	strftime(date2, sizeof(date2)-1, "%b %d  %Y", tmptr);
84
	strftime(date2, sizeof(date2)-1, "%b %d  %Y", tmptr);
102
	_snprintf(date, sizeof(date)-1, "%12.12s file", date2);
85
	_snprintf(date, sizeof(date)-1, "%12s file", date2);
103
#else
86
#else
104
	strftime(date2, sizeof(date2)-1, "%b %e  %Y", tmptr);
87
	strftime(date2, sizeof(date2)-1, "%b %e  %Y", tmptr);
105
	snprintf(date, sizeof(date)-1, "%12.12s file", date2);
88
	snprintf(date, sizeof(date)-1, "%12s file", date2);
106
#endif
89
#endif
107
	assertEqualMem(p + 42, date, strlen(date));
90
	assertEqualMem(p + 42, date, strlen(date));
108
	free(p);
91
	free(p);
(-)b/contrib/libarchive/cpio/test/test_option_u.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
#if defined(HAVE_UTIME_H)
8
#if defined(HAVE_UTIME_H)
(-)b/contrib/libarchive/cpio/test/test_option_uuencode.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cpio/test/test_option_version.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_xz.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/cpio/test/test_option_y.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_z.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_option_zstd.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_owner_parse.c (-51 / +61 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2009 Tim Kientzle
4
 * Copyright (c) 2003-2009 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 55-60 int_in_list(int i, const int *l, size_t n) Link Here
55
	failure("%d", i);
37
	failure("%d", i);
56
	return (0);
38
	return (0);
57
}
39
}
40
41
static void
42
free_cpio_owner(struct cpio_owner *owner) {
43
	owner->uid = -1;
44
	owner->gid = -1;
45
	free(owner->uname);
46
	free(owner->gname);
47
}
58
#endif
48
#endif
59
49
60
DEFINE_TEST(test_owner_parse)
50
DEFINE_TEST(test_owner_parse)
Lines 62-110 DEFINE_TEST(test_owner_parse) Link Here
62
#if !defined(ROOT)
52
#if !defined(ROOT)
63
	skipping("No uid/gid configuration for this OS");
53
	skipping("No uid/gid configuration for this OS");
64
#else
54
#else
65
	int uid, gid;
55
	struct cpio_owner owner;
56
	const char *errstr;
66
57
67
	assert(NULL == owner_parse(ROOT, &uid, &gid));
58
	assert(0 == owner_parse(ROOT, &owner, &errstr));
68
	assert(int_in_list(uid, root_uids,
59
	assert(int_in_list(owner.uid, root_uids,
69
		sizeof(root_uids)/sizeof(root_uids[0])));
60
		sizeof(root_uids)/sizeof(root_uids[0])));
70
	assertEqualInt(-1, gid);
61
	assertEqualInt(-1, owner.gid);
71
62
	free_cpio_owner(&owner);
72
63
73
	assert(NULL == owner_parse(ROOT ":", &uid, &gid));
64
	assert(0 == owner_parse(ROOT ":", &owner, &errstr));
74
	assert(int_in_list(uid, root_uids,
65
	assert(int_in_list(owner.uid, root_uids,
75
		sizeof(root_uids)/sizeof(root_uids[0])));
66
		sizeof(root_uids)/sizeof(root_uids[0])));
76
	assert(int_in_list(gid, root_gids,
67
	assert(int_in_list(owner.gid, root_gids,
77
		sizeof(root_gids)/sizeof(root_gids[0])));
68
		sizeof(root_gids)/sizeof(root_gids[0])));
69
	free_cpio_owner(&owner);
78
70
79
	assert(NULL == owner_parse(ROOT ".", &uid, &gid));
71
	assert(0 == owner_parse(ROOT ".", &owner, &errstr));
80
	assert(int_in_list(uid, root_uids,
72
	assert(int_in_list(owner.uid, root_uids,
81
		sizeof(root_uids)/sizeof(root_uids[0])));
73
		sizeof(root_uids)/sizeof(root_uids[0])));
82
	assert(int_in_list(gid, root_gids,
74
	assert(int_in_list(owner.gid, root_gids,
83
		sizeof(root_gids)/sizeof(root_gids[0])));
75
		sizeof(root_gids)/sizeof(root_gids[0])));
76
	free_cpio_owner(&owner);
84
77
85
	assert(NULL == owner_parse("111", &uid, &gid));
78
	assert(0 == owner_parse("111", &owner, &errstr));
86
	assertEqualInt(111, uid);
79
	assertEqualInt(111, owner.uid);
87
	assertEqualInt(-1, gid);
80
	assertEqualInt(-1, owner.gid);
81
	free_cpio_owner(&owner);
88
82
89
	assert(NULL == owner_parse("112:", &uid, &gid));
83
	assert(0 == owner_parse("112:", &owner, &errstr));
90
	assertEqualInt(112, uid);
84
	assertEqualInt(112, owner.uid);
91
	/* Can't assert gid, since we don't know gid for user #112. */
85
	/* Can't assert gid, since we don't know gid for user #112. */
86
	free_cpio_owner(&owner);
92
87
93
	assert(NULL == owner_parse("113.", &uid, &gid));
88
	assert(0 == owner_parse("113.", &owner, &errstr));
94
	assertEqualInt(113, uid);
89
	assertEqualInt(113, owner.uid);
95
	/* Can't assert gid, since we don't know gid for user #113. */
90
	/* Can't assert gid, since we don't know gid for user #113. */
91
	free_cpio_owner(&owner);
96
92
97
	assert(NULL == owner_parse(":114", &uid, &gid));
93
	assert(0 == owner_parse(":114", &owner, &errstr));
98
	assertEqualInt(-1, uid);
94
	assertEqualInt(-1, owner.uid);
99
	assertEqualInt(114, gid);
95
	assertEqualInt(114, owner.gid);
96
	free_cpio_owner(&owner);
100
97
101
	assert(NULL == owner_parse(".115", &uid, &gid));
98
	assert(0 == owner_parse(".115", &owner, &errstr));
102
	assertEqualInt(-1, uid);
99
	assertEqualInt(-1, owner.uid);
103
	assertEqualInt(115, gid);
100
	assertEqualInt(115, owner.gid);
101
	free_cpio_owner(&owner);
104
102
105
	assert(NULL == owner_parse("116:117", &uid, &gid));
103
	assert(0 == owner_parse("116:117", &owner, &errstr));
106
	assertEqualInt(116, uid);
104
	assertEqualInt(116, owner.uid);
107
	assertEqualInt(117, gid);
105
	assertEqualInt(117, owner.gid);
106
	free_cpio_owner(&owner);
108
107
109
	/*
108
	/*
110
	 * TODO: Lookup current user/group name, build strings and
109
	 * TODO: Lookup current user/group name, build strings and
Lines 112-120 DEFINE_TEST(test_owner_parse) Link Here
112
	 * users.
111
	 * users.
113
	 */
112
	 */
114
113
115
	assert(NULL != owner_parse(":nonexistentgroup", &uid, &gid));
114
	errstr = NULL;
116
	assert(NULL != owner_parse(ROOT ":nonexistentgroup", &uid, &gid));
115
	assert(0 != owner_parse(":nonexistentgroup", &owner, &errstr));
117
	assert(NULL !=
116
	assertEqualString(errstr, "Couldn't lookup group ``nonexistentgroup''");
118
	    owner_parse("nonexistentuser:nonexistentgroup", &uid, &gid));
117
	free_cpio_owner(&owner);
118
119
	errstr = NULL;
120
	assert(0 != owner_parse(ROOT ":nonexistentgroup", &owner, &errstr));
121
	assertEqualString(errstr, "Couldn't lookup group ``nonexistentgroup''");
122
	free_cpio_owner(&owner);
123
124
	errstr = NULL;
125
	assert(0 != owner_parse("nonexistentuser:nonexistentgroup", &owner,
126
	    &errstr));
127
	assertEqualString(errstr, "Couldn't lookup user ``nonexistentuser''");
128
	free_cpio_owner(&owner);
119
#endif
129
#endif
120
}
130
}
(-)b/contrib/libarchive/cpio/test/test_passthrough_dotdot.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/cpio/test/test_passthrough_reverse.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/libarchive/archive.h (-2 / +2 lines)
Lines 34-40 Link Here
34
 * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
34
 * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
35
 */
35
 */
36
/* Note: Compiler will complain if this does not match archive_entry.h! */
36
/* Note: Compiler will complain if this does not match archive_entry.h! */
37
#define	ARCHIVE_VERSION_NUMBER 3007004
37
#define	ARCHIVE_VERSION_NUMBER 3007007
38
38
39
#include <sys/stat.h>
39
#include <sys/stat.h>
40
#include <stddef.h>  /* for wchar_t */
40
#include <stddef.h>  /* for wchar_t */
Lines 155-161 __LA_DECL int archive_version_number(void); Link Here
155
/*
155
/*
156
 * Textual name/version of the library, useful for version displays.
156
 * Textual name/version of the library, useful for version displays.
157
 */
157
 */
158
#define	ARCHIVE_VERSION_ONLY_STRING "3.7.4"
158
#define	ARCHIVE_VERSION_ONLY_STRING "3.7.7"
159
#define	ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
159
#define	ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
160
__LA_DECL const char *	archive_version_string(void);
160
__LA_DECL const char *	archive_version_string(void);
161
161
(-)b/contrib/libarchive/libarchive/archive_acl.c (-32 / +39 lines)
Lines 56-62 static int archive_acl_add_entry_len_l(struct archive_acl *acl, Link Here
56
		    int type, int permset, int tag, int id, const char *name,
56
		    int type, int permset, int tag, int id, const char *name,
57
		    size_t len, struct archive_string_conv *sc);
57
		    size_t len, struct archive_string_conv *sc);
58
static int	archive_acl_text_want_type(struct archive_acl *acl, int flags);
58
static int	archive_acl_text_want_type(struct archive_acl *acl, int flags);
59
static ssize_t	archive_acl_text_len(struct archive_acl *acl, int want_type,
59
static size_t	archive_acl_text_len(struct archive_acl *acl, int want_type,
60
		    int flags, int wide, struct archive *a,
60
		    int flags, int wide, struct archive *a,
61
		    struct archive_string_conv *sc);
61
		    struct archive_string_conv *sc);
62
static int	isint_w(const wchar_t *start, const wchar_t *end, int *result);
62
static int	isint_w(const wchar_t *start, const wchar_t *end, int *result);
Lines 76-82 static int is_nfs4_flags(const char *start, const char *end, Link Here
76
		    int *result);
76
		    int *result);
77
static int	is_nfs4_perms(const char *start, const char *end,
77
static int	is_nfs4_perms(const char *start, const char *end,
78
		    int *result);
78
		    int *result);
79
static void	next_field(const char **p, const char **start,
79
static void	next_field(const char **p, size_t *l, const char **start,
80
		    const char **end, char *sep);
80
		    const char **end, char *sep);
81
static void	append_entry(char **p, const char *prefix, int type,
81
static void	append_entry(char **p, const char *prefix, int type,
82
		    int tag, int flags, const char *name, int perm, int id);
82
		    int tag, int flags, const char *name, int perm, int id);
Lines 346-352 acl_new_entry(struct archive_acl *acl, Link Here
346
	}
346
	}
347
347
348
	/* Add a new entry to the end of the list. */
348
	/* Add a new entry to the end of the list. */
349
	ap = (struct archive_acl_entry *)calloc(1, sizeof(*ap));
349
	ap = calloc(1, sizeof(*ap));
350
	if (ap == NULL)
350
	if (ap == NULL)
351
		return (NULL);
351
		return (NULL);
352
	if (aq == NULL)
352
	if (aq == NULL)
Lines 528-541 archive_acl_text_want_type(struct archive_acl *acl, int flags) Link Here
528
/*
528
/*
529
 * Calculate ACL text string length
529
 * Calculate ACL text string length
530
 */
530
 */
531
static ssize_t
531
static size_t
532
archive_acl_text_len(struct archive_acl *acl, int want_type, int flags,
532
archive_acl_text_len(struct archive_acl *acl, int want_type, int flags,
533
    int wide, struct archive *a, struct archive_string_conv *sc) {
533
    int wide, struct archive *a, struct archive_string_conv *sc) {
534
	struct archive_acl_entry *ap;
534
	struct archive_acl_entry *ap;
535
	const char *name;
535
	const char *name;
536
	const wchar_t *wname;
536
	const wchar_t *wname;
537
	int count, idlen, tmp, r;
537
	int count, idlen, tmp, r;
538
	ssize_t length;
538
	size_t length;
539
	size_t len;
539
	size_t len;
540
540
541
	count = 0;
541
	count = 0;
Lines 664-670 archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, Link Here
664
    struct archive *a)
664
    struct archive *a)
665
{
665
{
666
	int count;
666
	int count;
667
	ssize_t length;
667
	size_t length;
668
	size_t len;
668
	size_t len;
669
	const wchar_t *wname;
669
	const wchar_t *wname;
670
	const wchar_t *prefix;
670
	const wchar_t *prefix;
Lines 693-699 archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, Link Here
693
		separator = L'\n';
693
		separator = L'\n';
694
694
695
	/* Now, allocate the string and actually populate it. */
695
	/* Now, allocate the string and actually populate it. */
696
	wp = ws = (wchar_t *)malloc(length * sizeof(wchar_t));
696
	wp = ws = malloc(length * sizeof(*wp));
697
	if (wp == NULL) {
697
	if (wp == NULL) {
698
		if (errno == ENOMEM)
698
		if (errno == ENOMEM)
699
			__archive_errx(1, "No memory");
699
			__archive_errx(1, "No memory");
Lines 755-761 archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, Link Here
755
755
756
	len = wcslen(ws);
756
	len = wcslen(ws);
757
757
758
	if ((ssize_t)len > (length - 1))
758
	if (len > length - 1)
759
		__archive_errx(1, "Buffer overrun");
759
		__archive_errx(1, "Buffer overrun");
760
760
761
	if (text_len != NULL)
761
	if (text_len != NULL)
Lines 897-903 archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, Link Here
897
    struct archive_string_conv *sc)
897
    struct archive_string_conv *sc)
898
{
898
{
899
	int count;
899
	int count;
900
	ssize_t length;
900
	size_t length;
901
	size_t len;
901
	size_t len;
902
	const char *name;
902
	const char *name;
903
	const char *prefix;
903
	const char *prefix;
Lines 926-932 archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, Link Here
926
		separator = '\n';
926
		separator = '\n';
927
927
928
	/* Now, allocate the string and actually populate it. */
928
	/* Now, allocate the string and actually populate it. */
929
	p = s = (char *)malloc(length * sizeof(char));
929
	p = s = malloc(length * sizeof(*p));
930
	if (p == NULL) {
930
	if (p == NULL) {
931
		if (errno == ENOMEM)
931
		if (errno == ENOMEM)
932
			__archive_errx(1, "No memory");
932
			__archive_errx(1, "No memory");
Lines 990-996 archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, Link Here
990
990
991
	len = strlen(s);
991
	len = strlen(s);
992
992
993
	if ((ssize_t)len > (length - 1))
993
	if (len > length - 1)
994
		__archive_errx(1, "Buffer overrun");
994
		__archive_errx(1, "Buffer overrun");
995
995
996
	if (text_len != NULL)
996
	if (text_len != NULL)
Lines 1619-1624 next_field_w(const wchar_t **wp, const wchar_t **start, Link Here
1619
int
1619
int
1620
archive_acl_from_text_l(struct archive_acl *acl, const char *text,
1620
archive_acl_from_text_l(struct archive_acl *acl, const char *text,
1621
    int want_type, struct archive_string_conv *sc)
1621
    int want_type, struct archive_string_conv *sc)
1622
{
1623
	return archive_acl_from_text_nl(acl, text, strlen(text), want_type, sc);
1624
}
1625
1626
int
1627
archive_acl_from_text_nl(struct archive_acl *acl, const char *text,
1628
    size_t length, int want_type, struct archive_string_conv *sc)
1622
{
1629
{
1623
	struct {
1630
	struct {
1624
		const char *start;
1631
		const char *start;
Lines 1649-1655 archive_acl_from_text_l(struct archive_acl *acl, const char *text, Link Here
1649
	ret = ARCHIVE_OK;
1656
	ret = ARCHIVE_OK;
1650
	types = 0;
1657
	types = 0;
1651
1658
1652
	while (text != NULL &&  *text != '\0') {
1659
	while (text != NULL && length > 0 && *text != '\0') {
1653
		/*
1660
		/*
1654
		 * Parse the fields out of the next entry,
1661
		 * Parse the fields out of the next entry,
1655
		 * advance 'text' to start of next entry.
1662
		 * advance 'text' to start of next entry.
Lines 1657-1663 archive_acl_from_text_l(struct archive_acl *acl, const char *text, Link Here
1657
		fields = 0;
1664
		fields = 0;
1658
		do {
1665
		do {
1659
			const char *start, *end;
1666
			const char *start, *end;
1660
			next_field(&text, &start, &end, &sep);
1667
			next_field(&text, &length, &start, &end, &sep);
1661
			if (fields < numfields) {
1668
			if (fields < numfields) {
1662
				field[fields].start = start;
1669
				field[fields].start = start;
1663
				field[fields].end = end;
1670
				field[fields].end = end;
Lines 2047-2053 is_nfs4_flags(const char *start, const char *end, int *permset) Link Here
2047
}
2054
}
2048
2055
2049
/*
2056
/*
2050
 * Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]".  *wp is updated
2057
 * Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]".  *p is updated
2051
 * to point to just after the separator.  *start points to the first
2058
 * to point to just after the separator.  *start points to the first
2052
 * character of the matched text and *end just after the last
2059
 * character of the matched text and *end just after the last
2053
 * character of the matched identifier.  In particular *end - *start
2060
 * character of the matched identifier.  In particular *end - *start
Lines 2055-2096 is_nfs4_flags(const char *start, const char *end, int *permset) Link Here
2055
 * whitespace.
2062
 * whitespace.
2056
 */
2063
 */
2057
static void
2064
static void
2058
next_field(const char **p, const char **start,
2065
next_field(const char **p, size_t *l, const char **start,
2059
    const char **end, char *sep)
2066
    const char **end, char *sep)
2060
{
2067
{
2061
	/* Skip leading whitespace to find start of field. */
2068
	/* Skip leading whitespace to find start of field. */
2062
	while (**p == ' ' || **p == '\t' || **p == '\n') {
2069
	while (*l > 0 && (**p == ' ' || **p == '\t' || **p == '\n')) {
2063
		(*p)++;
2070
		(*p)++;
2071
		(*l)--;
2064
	}
2072
	}
2065
	*start = *p;
2073
	*start = *p;
2066
2074
2067
	/* Scan for the separator. */
2075
	/* Locate end of field, trim trailing whitespace if necessary */
2068
	while (**p != '\0' && **p != ',' && **p != ':' && **p != '\n' &&
2076
	while (*l > 0 && **p != ' ' && **p != '\t' && **p != '\n' && **p != ',' && **p != ':' && **p != '#') {
2069
	    **p != '#') {
2070
		(*p)++;
2077
		(*p)++;
2078
		(*l)--;
2071
	}
2079
	}
2072
	*sep = **p;
2080
	*end = *p;
2073
2081
2074
	/* Locate end of field, trim trailing whitespace if necessary */
2082
	/* Scan for the separator. */
2075
	if (*p == *start) {
2083
	while (*l > 0 && **p != ',' && **p != ':' && **p != '\n' && **p != '#') {
2076
		*end = *p;
2084
		(*p)++;
2077
	} else {
2085
		(*l)--;
2078
		*end = *p - 1;
2079
		while (**end == ' ' || **end == '\t' || **end == '\n') {
2080
			(*end)--;
2081
		}
2082
		(*end)++;
2083
	}
2086
	}
2087
	*sep = **p;
2084
2088
2085
	/* Handle in-field comments */
2089
	/* Handle in-field comments */
2086
	if (*sep == '#') {
2090
	if (*sep == '#') {
2087
		while (**p != '\0' && **p != ',' && **p != '\n') {
2091
		while (*l > 0 && **p != ',' && **p != '\n') {
2088
			(*p)++;
2092
			(*p)++;
2093
			(*l)--;
2089
		}
2094
		}
2090
		*sep = **p;
2095
		*sep = **p;
2091
	}
2096
	}
2092
2097
2093
	/* Adjust scanner location. */
2098
	/* Skip separator. */
2094
	if (**p != '\0')
2099
	if (*l > 0) {
2095
		(*p)++;
2100
		(*p)++;
2101
		(*l)--;
2102
	}
2096
}
2103
}
(-)b/contrib/libarchive/libarchive/archive_acl_private.h (+2 lines)
Lines 77-81 int archive_acl_from_text_w(struct archive_acl *, const wchar_t * /* wtext */, Link Here
77
    int /* type */);
77
    int /* type */);
78
int archive_acl_from_text_l(struct archive_acl *, const char * /* text */,
78
int archive_acl_from_text_l(struct archive_acl *, const char * /* text */,
79
    int /* type */, struct archive_string_conv *);
79
    int /* type */, struct archive_string_conv *);
80
int archive_acl_from_text_nl(struct archive_acl *, const char * /* text */,
81
    size_t /* size of text */, int /* type */, struct archive_string_conv *);
80
82
81
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
83
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
(-)b/contrib/libarchive/libarchive/archive_crc32.h (+5 lines)
Lines 30-35 Link Here
30
#error This header is only to be used internally to libarchive.
30
#error This header is only to be used internally to libarchive.
31
#endif
31
#endif
32
32
33
#include <stddef.h>
34
33
/*
35
/*
34
 * When zlib is unavailable, we should still be able to validate
36
 * When zlib is unavailable, we should still be able to validate
35
 * uncompressed zip archives.  That requires us to be able to compute
37
 * uncompressed zip archives.  That requires us to be able to compute
Lines 46-51 crc32(unsigned long crc, const void *_p, size_t len) Link Here
46
	static volatile int crc_tbl_inited = 0;
48
	static volatile int crc_tbl_inited = 0;
47
	static unsigned long crc_tbl[256];
49
	static unsigned long crc_tbl[256];
48
50
51
	if (_p == NULL)
52
		return (0);
53
49
	if (!crc_tbl_inited) {
54
	if (!crc_tbl_inited) {
50
		for (b = 0; b < 256; ++b) {
55
		for (b = 0; b < 256; ++b) {
51
			crc2 = b;
56
			crc2 = b;
(-)b/contrib/libarchive/libarchive/archive_cryptor.c (-2 / +2 lines)
Lines 57-63 pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, Link Here
57
	return 0;
57
	return 0;
58
}
58
}
59
59
60
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
60
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
61
#ifdef _MSC_VER
61
#ifdef _MSC_VER
62
#pragma comment(lib, "Bcrypt.lib")
62
#pragma comment(lib, "Bcrypt.lib")
63
#endif
63
#endif
Lines 197-203 aes_ctr_release(archive_crypto_ctx *ctx) Link Here
197
	return 0;
197
	return 0;
198
}
198
}
199
199
200
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
200
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
201
201
202
static int
202
static int
203
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
203
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
(-)b/contrib/libarchive/libarchive/archive_cryptor_private.h (-1 / +1 lines)
Lines 62-68 typedef struct { Link Here
62
	unsigned	encr_pos;
62
	unsigned	encr_pos;
63
} archive_crypto_ctx;
63
} archive_crypto_ctx;
64
64
65
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
65
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
66
#include <bcrypt.h>
66
#include <bcrypt.h>
67
67
68
/* Common in other bcrypt implementations, but missing from VS2008. */
68
/* Common in other bcrypt implementations, but missing from VS2008. */
(-)b/contrib/libarchive/libarchive/archive_entry.c (-97 / +203 lines)
Lines 118-124 Link Here
118
static char *	 ae_fflagstostr(unsigned long bitset, unsigned long bitclear);
118
static char *	 ae_fflagstostr(unsigned long bitset, unsigned long bitclear);
119
static const wchar_t	*ae_wcstofflags(const wchar_t *stringp,
119
static const wchar_t	*ae_wcstofflags(const wchar_t *stringp,
120
		    unsigned long *setp, unsigned long *clrp);
120
		    unsigned long *setp, unsigned long *clrp);
121
static const char	*ae_strtofflags(const char *stringp,
121
static const char	*ae_strtofflags(const char *stringp, size_t length,
122
		    unsigned long *setp, unsigned long *clrp);
122
		    unsigned long *setp, unsigned long *clrp);
123
123
124
#ifndef HAVE_WCSCPY
124
#ifndef HAVE_WCSCPY
Lines 157-166 archive_entry_clear(struct archive_entry *entry) Link Here
157
		return (NULL);
157
		return (NULL);
158
	archive_mstring_clean(&entry->ae_fflags_text);
158
	archive_mstring_clean(&entry->ae_fflags_text);
159
	archive_mstring_clean(&entry->ae_gname);
159
	archive_mstring_clean(&entry->ae_gname);
160
	archive_mstring_clean(&entry->ae_hardlink);
160
	archive_mstring_clean(&entry->ae_linkname);
161
	archive_mstring_clean(&entry->ae_pathname);
161
	archive_mstring_clean(&entry->ae_pathname);
162
	archive_mstring_clean(&entry->ae_sourcepath);
162
	archive_mstring_clean(&entry->ae_sourcepath);
163
	archive_mstring_clean(&entry->ae_symlink);
164
	archive_mstring_clean(&entry->ae_uname);
163
	archive_mstring_clean(&entry->ae_uname);
165
	archive_entry_copy_mac_metadata(entry, NULL, 0);
164
	archive_entry_copy_mac_metadata(entry, NULL, 0);
166
	archive_acl_clear(&entry->acl);
165
	archive_acl_clear(&entry->acl);
Lines 195-204 archive_entry_clone(struct archive_entry *entry) Link Here
195
	 * character sets are different? XXX */
194
	 * character sets are different? XXX */
196
	archive_mstring_copy(&entry2->ae_fflags_text, &entry->ae_fflags_text);
195
	archive_mstring_copy(&entry2->ae_fflags_text, &entry->ae_fflags_text);
197
	archive_mstring_copy(&entry2->ae_gname, &entry->ae_gname);
196
	archive_mstring_copy(&entry2->ae_gname, &entry->ae_gname);
198
	archive_mstring_copy(&entry2->ae_hardlink, &entry->ae_hardlink);
197
	archive_mstring_copy(&entry2->ae_linkname, &entry->ae_linkname);
199
	archive_mstring_copy(&entry2->ae_pathname, &entry->ae_pathname);
198
	archive_mstring_copy(&entry2->ae_pathname, &entry->ae_pathname);
200
	archive_mstring_copy(&entry2->ae_sourcepath, &entry->ae_sourcepath);
199
	archive_mstring_copy(&entry2->ae_sourcepath, &entry->ae_sourcepath);
201
	archive_mstring_copy(&entry2->ae_symlink, &entry->ae_symlink);
202
	entry2->ae_set = entry->ae_set;
200
	entry2->ae_set = entry->ae_set;
203
	archive_mstring_copy(&entry2->ae_uname, &entry->ae_uname);
201
	archive_mstring_copy(&entry2->ae_uname, &entry->ae_uname);
204
202
Lines 265-271 archive_entry_new2(struct archive *a) Link Here
265
{
263
{
266
	struct archive_entry *entry;
264
	struct archive_entry *entry;
267
265
268
	entry = (struct archive_entry *)calloc(1, sizeof(*entry));
266
	entry = calloc(1, sizeof(*entry));
269
	if (entry == NULL)
267
	if (entry == NULL)
270
		return (NULL);
268
		return (NULL);
271
	entry->archive = a;
269
	entry->archive = a;
Lines 477-482 _archive_entry_gname_l(struct archive_entry *entry, Link Here
477
	return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_gname, p, len, sc));
475
	return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_gname, p, len, sc));
478
}
476
}
479
477
478
void
479
archive_entry_set_link_to_hardlink(struct archive_entry *entry)
480
{
481
	if ((entry->ae_set & AE_SET_SYMLINK) != 0) {
482
		entry->ae_set &= ~AE_SET_SYMLINK;
483
	}
484
	entry->ae_set |= AE_SET_HARDLINK;
485
}
486
480
const char *
487
const char *
481
archive_entry_hardlink(struct archive_entry *entry)
488
archive_entry_hardlink(struct archive_entry *entry)
482
{
489
{
Lines 484-490 archive_entry_hardlink(struct archive_entry *entry) Link Here
484
	if ((entry->ae_set & AE_SET_HARDLINK) == 0)
491
	if ((entry->ae_set & AE_SET_HARDLINK) == 0)
485
		return (NULL);
492
		return (NULL);
486
	if (archive_mstring_get_mbs(
493
	if (archive_mstring_get_mbs(
487
	    entry->archive, &entry->ae_hardlink, &p) == 0)
494
	    entry->archive, &entry->ae_linkname, &p) == 0)
488
		return (p);
495
		return (p);
489
	if (errno == ENOMEM)
496
	if (errno == ENOMEM)
490
		__archive_errx(1, "No memory");
497
		__archive_errx(1, "No memory");
Lines 498-504 archive_entry_hardlink_utf8(struct archive_entry *entry) Link Here
498
	if ((entry->ae_set & AE_SET_HARDLINK) == 0)
505
	if ((entry->ae_set & AE_SET_HARDLINK) == 0)
499
		return (NULL);
506
		return (NULL);
500
	if (archive_mstring_get_utf8(
507
	if (archive_mstring_get_utf8(
501
	    entry->archive, &entry->ae_hardlink, &p) == 0)
508
	    entry->archive, &entry->ae_linkname, &p) == 0)
502
		return (p);
509
		return (p);
503
	if (errno == ENOMEM)
510
	if (errno == ENOMEM)
504
		__archive_errx(1, "No memory");
511
		__archive_errx(1, "No memory");
Lines 512-524 archive_entry_hardlink_w(struct archive_entry *entry) Link Here
512
	if ((entry->ae_set & AE_SET_HARDLINK) == 0)
519
	if ((entry->ae_set & AE_SET_HARDLINK) == 0)
513
		return (NULL);
520
		return (NULL);
514
	if (archive_mstring_get_wcs(
521
	if (archive_mstring_get_wcs(
515
	    entry->archive, &entry->ae_hardlink, &p) == 0)
522
	    entry->archive, &entry->ae_linkname, &p) == 0)
516
		return (p);
523
		return (p);
517
	if (errno == ENOMEM)
524
	if (errno == ENOMEM)
518
		__archive_errx(1, "No memory");
525
		__archive_errx(1, "No memory");
519
	return (NULL);
526
	return (NULL);
520
}
527
}
521
528
529
int
530
archive_entry_hardlink_is_set(struct archive_entry *entry)
531
{
532
	return (entry->ae_set & AE_SET_HARDLINK) != 0;
533
}
534
522
int
535
int
523
_archive_entry_hardlink_l(struct archive_entry *entry,
536
_archive_entry_hardlink_l(struct archive_entry *entry,
524
    const char **p, size_t *len, struct archive_string_conv *sc)
537
    const char **p, size_t *len, struct archive_string_conv *sc)
Lines 528-534 _archive_entry_hardlink_l(struct archive_entry *entry, Link Here
528
		*len = 0;
541
		*len = 0;
529
		return (0);
542
		return (0);
530
	}
543
	}
531
	return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_hardlink, p, len, sc));
544
	return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_linkname, p, len, sc));
532
}
545
}
533
546
534
la_int64_t
547
la_int64_t
Lines 648-679 archive_entry_perm_is_set(struct archive_entry *entry) Link Here
648
	return (entry->ae_set & AE_SET_PERM);
661
	return (entry->ae_set & AE_SET_PERM);
649
}
662
}
650
663
664
int
665
archive_entry_rdev_is_set(struct archive_entry *entry)
666
{
667
	return (entry->ae_set & AE_SET_RDEV);
668
}
669
651
dev_t
670
dev_t
652
archive_entry_rdev(struct archive_entry *entry)
671
archive_entry_rdev(struct archive_entry *entry)
653
{
672
{
654
	if (entry->ae_stat.aest_rdev_is_broken_down)
673
	if (archive_entry_rdev_is_set(entry)) {
655
		return ae_makedev(entry->ae_stat.aest_rdevmajor,
674
		if (entry->ae_stat.aest_rdev_is_broken_down)
656
		    entry->ae_stat.aest_rdevminor);
675
			return ae_makedev(entry->ae_stat.aest_rdevmajor,
657
	else
676
			    entry->ae_stat.aest_rdevminor);
658
		return (entry->ae_stat.aest_rdev);
677
		else
678
			return (entry->ae_stat.aest_rdev);
679
	} else {
680
		return 0;
681
	}
659
}
682
}
660
683
661
dev_t
684
dev_t
662
archive_entry_rdevmajor(struct archive_entry *entry)
685
archive_entry_rdevmajor(struct archive_entry *entry)
663
{
686
{
664
	if (entry->ae_stat.aest_rdev_is_broken_down)
687
	if (archive_entry_rdev_is_set(entry)) {
665
		return (entry->ae_stat.aest_rdevmajor);
688
		if (entry->ae_stat.aest_rdev_is_broken_down)
666
	else
689
			return (entry->ae_stat.aest_rdevmajor);
667
		return major(entry->ae_stat.aest_rdev);
690
		else
691
			return major(entry->ae_stat.aest_rdev);
692
	} else {
693
		return 0;
694
	}
668
}
695
}
669
696
670
dev_t
697
dev_t
671
archive_entry_rdevminor(struct archive_entry *entry)
698
archive_entry_rdevminor(struct archive_entry *entry)
672
{
699
{
673
	if (entry->ae_stat.aest_rdev_is_broken_down)
700
	if (archive_entry_rdev_is_set(entry)) {
674
		return (entry->ae_stat.aest_rdevminor);
701
		if (entry->ae_stat.aest_rdev_is_broken_down)
675
	else
702
			return (entry->ae_stat.aest_rdevminor);
676
		return minor(entry->ae_stat.aest_rdev);
703
		else
704
			return minor(entry->ae_stat.aest_rdev);
705
	} else {
706
		return 0;
707
	}
677
}
708
}
678
709
679
la_int64_t
710
la_int64_t
Lines 717-729 archive_entry_symlink(struct archive_entry *entry) Link Here
717
	if ((entry->ae_set & AE_SET_SYMLINK) == 0)
748
	if ((entry->ae_set & AE_SET_SYMLINK) == 0)
718
		return (NULL);
749
		return (NULL);
719
	if (archive_mstring_get_mbs(
750
	if (archive_mstring_get_mbs(
720
	    entry->archive, &entry->ae_symlink, &p) == 0)
751
	    entry->archive, &entry->ae_linkname, &p) == 0)
721
		return (p);
752
		return (p);
722
	if (errno == ENOMEM)
753
	if (errno == ENOMEM)
723
		__archive_errx(1, "No memory");
754
		__archive_errx(1, "No memory");
724
	return (NULL);
755
	return (NULL);
725
}
756
}
726
757
758
void
759
archive_entry_set_link_to_symlink(struct archive_entry *entry)
760
{
761
	if ((entry->ae_set & AE_SET_HARDLINK) != 0) {
762
		entry->ae_set &= ~AE_SET_HARDLINK;
763
	}
764
	entry->ae_set |= AE_SET_SYMLINK;
765
}
766
727
int
767
int
728
archive_entry_symlink_type(struct archive_entry *entry)
768
archive_entry_symlink_type(struct archive_entry *entry)
729
{
769
{
Lines 737-743 archive_entry_symlink_utf8(struct archive_entry *entry) Link Here
737
	if ((entry->ae_set & AE_SET_SYMLINK) == 0)
777
	if ((entry->ae_set & AE_SET_SYMLINK) == 0)
738
		return (NULL);
778
		return (NULL);
739
	if (archive_mstring_get_utf8(
779
	if (archive_mstring_get_utf8(
740
	    entry->archive, &entry->ae_symlink, &p) == 0)
780
	    entry->archive, &entry->ae_linkname, &p) == 0)
741
		return (p);
781
		return (p);
742
	if (errno == ENOMEM)
782
	if (errno == ENOMEM)
743
		__archive_errx(1, "No memory");
783
		__archive_errx(1, "No memory");
Lines 751-757 archive_entry_symlink_w(struct archive_entry *entry) Link Here
751
	if ((entry->ae_set & AE_SET_SYMLINK) == 0)
791
	if ((entry->ae_set & AE_SET_SYMLINK) == 0)
752
		return (NULL);
792
		return (NULL);
753
	if (archive_mstring_get_wcs(
793
	if (archive_mstring_get_wcs(
754
	    entry->archive, &entry->ae_symlink, &p) == 0)
794
	    entry->archive, &entry->ae_linkname, &p) == 0)
755
		return (p);
795
		return (p);
756
	if (errno == ENOMEM)
796
	if (errno == ENOMEM)
757
		__archive_errx(1, "No memory");
797
		__archive_errx(1, "No memory");
Lines 767-773 _archive_entry_symlink_l(struct archive_entry *entry, Link Here
767
		*len = 0;
807
		*len = 0;
768
		return (0);
808
		return (0);
769
	}
809
	}
770
	return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_symlink, p, len, sc));
810
	return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_linkname, p, len, sc));
771
}
811
}
772
812
773
la_int64_t
813
la_int64_t
Lines 864-873 archive_entry_set_fflags(struct archive_entry *entry, Link Here
864
904
865
const char *
905
const char *
866
archive_entry_copy_fflags_text(struct archive_entry *entry,
906
archive_entry_copy_fflags_text(struct archive_entry *entry,
867
    const char *flags)
907
	const char *flags)
908
{
909
	return archive_entry_copy_fflags_text_len(entry, flags, strlen(flags));
910
}
911
912
const char *
913
archive_entry_copy_fflags_text_len(struct archive_entry *entry,
914
    const char *flags, size_t flags_length)
868
{
915
{
869
	archive_mstring_copy_mbs(&entry->ae_fflags_text, flags);
916
	archive_mstring_copy_mbs_len(&entry->ae_fflags_text, flags, flags_length);
870
	return (ae_strtofflags(flags,
917
	return (ae_strtofflags(flags, flags_length,
871
		    &entry->ae_fflags_set, &entry->ae_fflags_clear));
918
		    &entry->ae_fflags_set, &entry->ae_fflags_clear));
872
}
919
}
873
920
Lines 883-888 archive_entry_copy_fflags_text_w(struct archive_entry *entry, Link Here
883
void
930
void
884
archive_entry_set_gid(struct archive_entry *entry, la_int64_t g)
931
archive_entry_set_gid(struct archive_entry *entry, la_int64_t g)
885
{
932
{
933
	if (g < 0) {
934
		g = 0;
935
	}
886
	entry->stat_valid = 0;
936
	entry->stat_valid = 0;
887
	entry->ae_stat.aest_gid = g;
937
	entry->ae_stat.aest_gid = g;
888
	entry->ae_set |= AE_SET_GID;
938
	entry->ae_set |= AE_SET_GID;
Lines 933-938 _archive_entry_copy_gname_l(struct archive_entry *entry, Link Here
933
void
983
void
934
archive_entry_set_ino(struct archive_entry *entry, la_int64_t ino)
984
archive_entry_set_ino(struct archive_entry *entry, la_int64_t ino)
935
{
985
{
986
	if (ino < 0) {
987
		ino = 0;
988
	}
936
	entry->stat_valid = 0;
989
	entry->stat_valid = 0;
937
	entry->ae_set |= AE_SET_INO;
990
	entry->ae_set |= AE_SET_INO;
938
	entry->ae_stat.aest_ino = ino;
991
	entry->ae_stat.aest_ino = ino;
Lines 941-946 archive_entry_set_ino(struct archive_entry *entry, la_int64_t ino) Link Here
941
void
994
void
942
archive_entry_set_ino64(struct archive_entry *entry, la_int64_t ino)
995
archive_entry_set_ino64(struct archive_entry *entry, la_int64_t ino)
943
{
996
{
997
	if (ino < 0) {
998
		ino = 0;
999
	}
944
	entry->stat_valid = 0;
1000
	entry->stat_valid = 0;
945
	entry->ae_set |= AE_SET_INO;
1001
	entry->ae_set |= AE_SET_INO;
946
	entry->ae_stat.aest_ino = ino;
1002
	entry->ae_stat.aest_ino = ino;
Lines 949-965 archive_entry_set_ino64(struct archive_entry *entry, la_int64_t ino) Link Here
949
void
1005
void
950
archive_entry_set_hardlink(struct archive_entry *entry, const char *target)
1006
archive_entry_set_hardlink(struct archive_entry *entry, const char *target)
951
{
1007
{
952
	archive_mstring_copy_mbs(&entry->ae_hardlink, target);
1008
	if (target == NULL) {
953
	if (target != NULL)
954
		entry->ae_set |= AE_SET_HARDLINK;
955
	else
956
		entry->ae_set &= ~AE_SET_HARDLINK;
1009
		entry->ae_set &= ~AE_SET_HARDLINK;
1010
		if (entry->ae_set & AE_SET_SYMLINK) {
1011
			return;
1012
		}
1013
	} else {
1014
		entry->ae_set |= AE_SET_HARDLINK;
1015
	}
1016
	entry->ae_set &= ~AE_SET_SYMLINK;
1017
	archive_mstring_copy_mbs(&entry->ae_linkname, target);
957
}
1018
}
958
1019
959
void
1020
void
960
archive_entry_set_hardlink_utf8(struct archive_entry *entry, const char *target)
1021
archive_entry_set_hardlink_utf8(struct archive_entry *entry, const char *target)
961
{
1022
{
962
	archive_mstring_copy_utf8(&entry->ae_hardlink, target);
1023
	if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
1024
		return;
1025
	archive_mstring_copy_utf8(&entry->ae_linkname, target);
963
	if (target != NULL)
1026
	if (target != NULL)
964
		entry->ae_set |= AE_SET_HARDLINK;
1027
		entry->ae_set |= AE_SET_HARDLINK;
965
	else
1028
	else
Lines 969-975 archive_entry_set_hardlink_utf8(struct archive_entry *entry, const char *target) Link Here
969
void
1032
void
970
archive_entry_copy_hardlink(struct archive_entry *entry, const char *target)
1033
archive_entry_copy_hardlink(struct archive_entry *entry, const char *target)
971
{
1034
{
972
	archive_mstring_copy_mbs(&entry->ae_hardlink, target);
1035
	if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
1036
		return;
1037
	archive_mstring_copy_mbs(&entry->ae_linkname, target);
973
	if (target != NULL)
1038
	if (target != NULL)
974
		entry->ae_set |= AE_SET_HARDLINK;
1039
		entry->ae_set |= AE_SET_HARDLINK;
975
	else
1040
	else
Lines 979-985 archive_entry_copy_hardlink(struct archive_entry *entry, const char *target) Link Here
979
void
1044
void
980
archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target)
1045
archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target)
981
{
1046
{
982
	archive_mstring_copy_wcs(&entry->ae_hardlink, target);
1047
	if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
1048
		return;
1049
	archive_mstring_copy_wcs(&entry->ae_linkname, target);
983
	if (target != NULL)
1050
	if (target != NULL)
984
		entry->ae_set |= AE_SET_HARDLINK;
1051
		entry->ae_set |= AE_SET_HARDLINK;
985
	else
1052
	else
Lines 989-1000 archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target Link Here
989
int
1056
int
990
archive_entry_update_hardlink_utf8(struct archive_entry *entry, const char *target)
1057
archive_entry_update_hardlink_utf8(struct archive_entry *entry, const char *target)
991
{
1058
{
1059
	if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
1060
		return (0);
992
	if (target != NULL)
1061
	if (target != NULL)
993
		entry->ae_set |= AE_SET_HARDLINK;
1062
		entry->ae_set |= AE_SET_HARDLINK;
994
	else
1063
	else
995
		entry->ae_set &= ~AE_SET_HARDLINK;
1064
		entry->ae_set &= ~AE_SET_HARDLINK;
996
	if (archive_mstring_update_utf8(entry->archive,
1065
	if (archive_mstring_update_utf8(entry->archive,
997
	    &entry->ae_hardlink, target) == 0)
1066
	    &entry->ae_linkname, target) == 0)
998
		return (1);
1067
		return (1);
999
	if (errno == ENOMEM)
1068
	if (errno == ENOMEM)
1000
		__archive_errx(1, "No memory");
1069
		__archive_errx(1, "No memory");
Lines 1007-1013 _archive_entry_copy_hardlink_l(struct archive_entry *entry, Link Here
1007
{
1076
{
1008
	int r;
1077
	int r;
1009
1078
1010
	r = archive_mstring_copy_mbs_len_l(&entry->ae_hardlink,
1079
	if (target == NULL && (entry->ae_set & AE_SET_SYMLINK))
1080
		return (0);
1081
	r = archive_mstring_copy_mbs_len_l(&entry->ae_linkname,
1011
	    target, len, sc);
1082
	    target, len, sc);
1012
	if (target != NULL && r == 0)
1083
	if (target != NULL && r == 0)
1013
		entry->ae_set |= AE_SET_HARDLINK;
1084
		entry->ae_set |= AE_SET_HARDLINK;
Lines 1098-1148 archive_entry_set_devminor(struct archive_entry *entry, dev_t m) Link Here
1098
void
1169
void
1099
archive_entry_set_link(struct archive_entry *entry, const char *target)
1170
archive_entry_set_link(struct archive_entry *entry, const char *target)
1100
{
1171
{
1101
	if (entry->ae_set & AE_SET_SYMLINK)
1172
	archive_mstring_copy_mbs(&entry->ae_linkname, target);
1102
		archive_mstring_copy_mbs(&entry->ae_symlink, target);
1173
	if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
1103
	else
1174
		entry->ae_set |= AE_SET_HARDLINK;
1104
		archive_mstring_copy_mbs(&entry->ae_hardlink, target);
1175
	}
1105
}
1176
}
1106
1177
1107
void
1178
void
1108
archive_entry_set_link_utf8(struct archive_entry *entry, const char *target)
1179
archive_entry_set_link_utf8(struct archive_entry *entry, const char *target)
1109
{
1180
{
1110
	if (entry->ae_set & AE_SET_SYMLINK)
1181
	archive_mstring_copy_utf8(&entry->ae_linkname, target);
1111
		archive_mstring_copy_utf8(&entry->ae_symlink, target);
1182
	if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
1112
	else
1183
		entry->ae_set |= AE_SET_HARDLINK;
1113
		archive_mstring_copy_utf8(&entry->ae_hardlink, target);
1184
	}
1114
}
1185
}
1115
1186
1116
/* Set symlink if symlink is already set, else set hardlink. */
1187
/* Set symlink if symlink is already set, else set hardlink. */
1117
void
1188
void
1118
archive_entry_copy_link(struct archive_entry *entry, const char *target)
1189
archive_entry_copy_link(struct archive_entry *entry, const char *target)
1119
{
1190
{
1120
	if (entry->ae_set & AE_SET_SYMLINK)
1191
	archive_mstring_copy_mbs(&entry->ae_linkname, target);
1121
		archive_mstring_copy_mbs(&entry->ae_symlink, target);
1192
	if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
1122
	else
1193
		entry->ae_set |= AE_SET_HARDLINK;
1123
		archive_mstring_copy_mbs(&entry->ae_hardlink, target);
1194
	}
1124
}
1195
}
1125
1196
1126
/* Set symlink if symlink is already set, else set hardlink. */
1197
/* Set symlink if symlink is already set, else set hardlink. */
1127
void
1198
void
1128
archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target)
1199
archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target)
1129
{
1200
{
1130
	if (entry->ae_set & AE_SET_SYMLINK)
1201
	archive_mstring_copy_wcs(&entry->ae_linkname, target);
1131
		archive_mstring_copy_wcs(&entry->ae_symlink, target);
1202
	if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
1132
	else
1203
		entry->ae_set |= AE_SET_HARDLINK;
1133
		archive_mstring_copy_wcs(&entry->ae_hardlink, target);
1204
	}
1134
}
1205
}
1135
1206
1136
int
1207
int
1137
archive_entry_update_link_utf8(struct archive_entry *entry, const char *target)
1208
archive_entry_update_link_utf8(struct archive_entry *entry, const char *target)
1138
{
1209
{
1139
	int r;
1210
	int r;
1140
	if (entry->ae_set & AE_SET_SYMLINK)
1211
	r = archive_mstring_update_utf8(entry->archive,
1141
		r = archive_mstring_update_utf8(entry->archive,
1212
		    &entry->ae_linkname, target);
1142
		    &entry->ae_symlink, target);
1213
	if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
1143
	else
1214
		entry->ae_set |= AE_SET_HARDLINK;
1144
		r = archive_mstring_update_utf8(entry->archive,
1215
	}
1145
		    &entry->ae_hardlink, target);
1146
	if (r == 0)
1216
	if (r == 0)
1147
		return (1);
1217
		return (1);
1148
	if (errno == ENOMEM)
1218
	if (errno == ENOMEM)
Lines 1156-1167 _archive_entry_copy_link_l(struct archive_entry *entry, Link Here
1156
{
1226
{
1157
	int r;
1227
	int r;
1158
1228
1159
	if (entry->ae_set & AE_SET_SYMLINK)
1229
	r = archive_mstring_copy_mbs_len_l(&entry->ae_linkname,
1160
		r = archive_mstring_copy_mbs_len_l(&entry->ae_symlink,
1161
		    target, len, sc);
1162
	else
1163
		r = archive_mstring_copy_mbs_len_l(&entry->ae_hardlink,
1164
		    target, len, sc);
1230
		    target, len, sc);
1231
	if ((entry->ae_set & AE_SET_SYMLINK) == 0) {
1232
		entry->ae_set |= AE_SET_HARDLINK;
1233
	}
1165
	return (r);
1234
	return (r);
1166
}
1235
}
1167
1236
Lines 1255-1260 archive_entry_set_rdev(struct archive_entry *entry, dev_t m) Link Here
1255
	entry->stat_valid = 0;
1324
	entry->stat_valid = 0;
1256
	entry->ae_stat.aest_rdev = m;
1325
	entry->ae_stat.aest_rdev = m;
1257
	entry->ae_stat.aest_rdev_is_broken_down = 0;
1326
	entry->ae_stat.aest_rdev_is_broken_down = 0;
1327
	entry->ae_stat.aest_rdevmajor = 0;
1328
	entry->ae_stat.aest_rdevminor = 0;
1329
	entry->ae_set |= AE_SET_RDEV;
1258
}
1330
}
1259
1331
1260
void
1332
void
Lines 1262-1268 archive_entry_set_rdevmajor(struct archive_entry *entry, dev_t m) Link Here
1262
{
1334
{
1263
	entry->stat_valid = 0;
1335
	entry->stat_valid = 0;
1264
	entry->ae_stat.aest_rdev_is_broken_down = 1;
1336
	entry->ae_stat.aest_rdev_is_broken_down = 1;
1337
	entry->ae_stat.aest_rdev = 0;
1265
	entry->ae_stat.aest_rdevmajor = m;
1338
	entry->ae_stat.aest_rdevmajor = m;
1339
	entry->ae_set |= AE_SET_RDEV;
1266
}
1340
}
1267
1341
1268
void
1342
void
Lines 1270-1281 archive_entry_set_rdevminor(struct archive_entry *entry, dev_t m) Link Here
1270
{
1344
{
1271
	entry->stat_valid = 0;
1345
	entry->stat_valid = 0;
1272
	entry->ae_stat.aest_rdev_is_broken_down = 1;
1346
	entry->ae_stat.aest_rdev_is_broken_down = 1;
1347
	entry->ae_stat.aest_rdev = 0;
1273
	entry->ae_stat.aest_rdevminor = m;
1348
	entry->ae_stat.aest_rdevminor = m;
1349
	entry->ae_set |= AE_SET_RDEV;
1274
}
1350
}
1275
1351
1276
void
1352
void
1277
archive_entry_set_size(struct archive_entry *entry, la_int64_t s)
1353
archive_entry_set_size(struct archive_entry *entry, la_int64_t s)
1278
{
1354
{
1355
	if (s < 0) {
1356
		s = 0;
1357
	}
1279
	entry->stat_valid = 0;
1358
	entry->stat_valid = 0;
1280
	entry->ae_stat.aest_size = s;
1359
	entry->ae_stat.aest_size = s;
1281
	entry->ae_set |= AE_SET_SIZE;
1360
	entry->ae_set |= AE_SET_SIZE;
Lines 1303-1313 archive_entry_copy_sourcepath_w(struct archive_entry *entry, const wchar_t *path Link Here
1303
void
1382
void
1304
archive_entry_set_symlink(struct archive_entry *entry, const char *linkname)
1383
archive_entry_set_symlink(struct archive_entry *entry, const char *linkname)
1305
{
1384
{
1306
	archive_mstring_copy_mbs(&entry->ae_symlink, linkname);
1385
	if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
1307
	if (linkname != NULL)
1386
		return;
1308
		entry->ae_set |= AE_SET_SYMLINK;
1387
	archive_mstring_copy_mbs(&entry->ae_linkname, linkname);
1309
	else
1388
	entry->ae_set &= ~AE_SET_HARDLINK;
1389
	if (linkname == NULL)
1310
		entry->ae_set &= ~AE_SET_SYMLINK;
1390
		entry->ae_set &= ~AE_SET_SYMLINK;
1391
	else
1392
		entry->ae_set |= AE_SET_SYMLINK;
1311
}
1393
}
1312
1394
1313
void
1395
void
Lines 1319-1360 archive_entry_set_symlink_type(struct archive_entry *entry, int type) Link Here
1319
void
1401
void
1320
archive_entry_set_symlink_utf8(struct archive_entry *entry, const char *linkname)
1402
archive_entry_set_symlink_utf8(struct archive_entry *entry, const char *linkname)
1321
{
1403
{
1322
	archive_mstring_copy_utf8(&entry->ae_symlink, linkname);
1404
	if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
1323
	if (linkname != NULL)
1405
		return;
1324
		entry->ae_set |= AE_SET_SYMLINK;
1406
	archive_mstring_copy_utf8(&entry->ae_linkname, linkname);
1325
	else
1407
	entry->ae_set &= ~AE_SET_HARDLINK;
1408
	if (linkname == NULL)
1326
		entry->ae_set &= ~AE_SET_SYMLINK;
1409
		entry->ae_set &= ~AE_SET_SYMLINK;
1410
	else
1411
		entry->ae_set |= AE_SET_SYMLINK;
1327
}
1412
}
1328
1413
1329
void
1414
void
1330
archive_entry_copy_symlink(struct archive_entry *entry, const char *linkname)
1415
archive_entry_copy_symlink(struct archive_entry *entry, const char *linkname)
1331
{
1416
{
1332
	archive_mstring_copy_mbs(&entry->ae_symlink, linkname);
1417
	if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
1333
	if (linkname != NULL)
1418
		return;
1334
		entry->ae_set |= AE_SET_SYMLINK;
1419
	archive_mstring_copy_mbs(&entry->ae_linkname, linkname);
1335
	else
1420
	entry->ae_set &= ~AE_SET_HARDLINK;
1421
	if (linkname == NULL)
1336
		entry->ae_set &= ~AE_SET_SYMLINK;
1422
		entry->ae_set &= ~AE_SET_SYMLINK;
1423
	else
1424
		entry->ae_set |= AE_SET_SYMLINK;
1337
}
1425
}
1338
1426
1339
void
1427
void
1340
archive_entry_copy_symlink_w(struct archive_entry *entry, const wchar_t *linkname)
1428
archive_entry_copy_symlink_w(struct archive_entry *entry, const wchar_t *linkname)
1341
{
1429
{
1342
	archive_mstring_copy_wcs(&entry->ae_symlink, linkname);
1430
	if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
1343
	if (linkname != NULL)
1431
		return;
1344
		entry->ae_set |= AE_SET_SYMLINK;
1432
	archive_mstring_copy_wcs(&entry->ae_linkname, linkname);
1345
	else
1433
	entry->ae_set &= ~AE_SET_HARDLINK;
1434
	if (linkname == NULL)
1346
		entry->ae_set &= ~AE_SET_SYMLINK;
1435
		entry->ae_set &= ~AE_SET_SYMLINK;
1436
	else
1437
		entry->ae_set |= AE_SET_SYMLINK;
1347
}
1438
}
1348
1439
1349
int
1440
int
1350
archive_entry_update_symlink_utf8(struct archive_entry *entry, const char *linkname)
1441
archive_entry_update_symlink_utf8(struct archive_entry *entry, const char *linkname)
1351
{
1442
{
1352
	if (linkname != NULL)
1443
	if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
1353
		entry->ae_set |= AE_SET_SYMLINK;
1444
		return (0);
1354
	else
1445
	entry->ae_set &= ~AE_SET_HARDLINK;
1446
	if (linkname == NULL)
1355
		entry->ae_set &= ~AE_SET_SYMLINK;
1447
		entry->ae_set &= ~AE_SET_SYMLINK;
1448
	else
1449
		entry->ae_set |= AE_SET_SYMLINK;
1356
	if (archive_mstring_update_utf8(entry->archive,
1450
	if (archive_mstring_update_utf8(entry->archive,
1357
	    &entry->ae_symlink, linkname) == 0)
1451
	    &entry->ae_linkname, linkname) == 0)
1358
		return (1);
1452
		return (1);
1359
	if (errno == ENOMEM)
1453
	if (errno == ENOMEM)
1360
		__archive_errx(1, "No memory");
1454
		__archive_errx(1, "No memory");
Lines 1367-1384 _archive_entry_copy_symlink_l(struct archive_entry *entry, Link Here
1367
{
1461
{
1368
	int r;
1462
	int r;
1369
1463
1370
	r = archive_mstring_copy_mbs_len_l(&entry->ae_symlink,
1464
	if (linkname == NULL && (entry->ae_set & AE_SET_HARDLINK))
1465
		return (0);
1466
	entry->ae_set &= ~AE_SET_HARDLINK;
1467
	r = archive_mstring_copy_mbs_len_l(&entry->ae_linkname,
1371
	    linkname, len, sc);
1468
	    linkname, len, sc);
1372
	if (linkname != NULL && r == 0)
1469
	if (linkname == NULL || r != 0)
1373
		entry->ae_set |= AE_SET_SYMLINK;
1374
	else
1375
		entry->ae_set &= ~AE_SET_SYMLINK;
1470
		entry->ae_set &= ~AE_SET_SYMLINK;
1471
	else
1472
		entry->ae_set |= AE_SET_SYMLINK;
1376
	return (r);
1473
	return (r);
1377
}
1474
}
1378
1475
1379
void
1476
void
1380
archive_entry_set_uid(struct archive_entry *entry, la_int64_t u)
1477
archive_entry_set_uid(struct archive_entry *entry, la_int64_t u)
1381
{
1478
{
1479
	if (u < 0) {
1480
		u = 0;
1481
	}
1382
	entry->stat_valid = 0;
1482
	entry->stat_valid = 0;
1383
	entry->ae_stat.aest_uid = u;
1483
	entry->ae_stat.aest_uid = u;
1384
	entry->ae_set |= AE_SET_UID;
1484
	entry->ae_set |= AE_SET_UID;
Lines 1995-2001 ae_fflagstostr(unsigned long bitset, unsigned long bitclear) Link Here
1995
2095
1996
	if (length == 0)
2096
	if (length == 0)
1997
		return (NULL);
2097
		return (NULL);
1998
	string = (char *)malloc(length);
2098
	string = malloc(length);
1999
	if (string == NULL)
2099
	if (string == NULL)
2000
		return (NULL);
2100
		return (NULL);
2001
2101
Lines 2031-2037 ae_fflagstostr(unsigned long bitset, unsigned long bitclear) Link Here
2031
 *	provided string.
2131
 *	provided string.
2032
 */
2132
 */
2033
static const char *
2133
static const char *
2034
ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp)
2134
ae_strtofflags(const char *s, size_t l, unsigned long *setp, unsigned long *clrp)
2035
{
2135
{
2036
	const char *start, *end;
2136
	const char *start, *end;
2037
	const struct flag *flag;
2137
	const struct flag *flag;
Lines 2042-2056 ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp) Link Here
2042
	start = s;
2142
	start = s;
2043
	failed = NULL;
2143
	failed = NULL;
2044
	/* Find start of first token. */
2144
	/* Find start of first token. */
2045
	while (*start == '\t'  ||  *start == ' '  ||  *start == ',')
2145
	while (l > 0 && (*start == '\t'  ||  *start == ' '  ||  *start == ',')) {
2046
		start++;
2146
		start++;
2047
	while (*start != '\0') {
2147
		l--;
2148
	}
2149
	while (l > 0) {
2048
		size_t length;
2150
		size_t length;
2049
		/* Locate end of token. */
2151
		/* Locate end of token. */
2050
		end = start;
2152
		end = start;
2051
		while (*end != '\0'  &&  *end != '\t'  &&
2153
		while (l > 0 && *end != '\t'  &&
2052
		    *end != ' '  &&  *end != ',')
2154
		    *end != ' '  &&  *end != ',') {
2053
			end++;
2155
			end++;
2156
			l--;
2157
		}
2054
		length = end - start;
2158
		length = end - start;
2055
		for (flag = fileflags; flag->name != NULL; flag++) {
2159
		for (flag = fileflags; flag->name != NULL; flag++) {
2056
			size_t flag_length = strlen(flag->name);
2160
			size_t flag_length = strlen(flag->name);
Lines 2074-2081 ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp) Link Here
2074
2178
2075
		/* Find start of next token. */
2179
		/* Find start of next token. */
2076
		start = end;
2180
		start = end;
2077
		while (*start == '\t'  ||  *start == ' '  ||  *start == ',')
2181
		while (l > 0 && (*start == '\t'  ||  *start == ' '  ||  *start == ',')) {
2078
			start++;
2182
			start++;
2183
			l--;
2184
		}
2079
2185
2080
	}
2186
	}
2081
2187
(-)b/contrib/libarchive/libarchive/archive_entry.h (-1 / +7 lines)
Lines 28-34 Link Here
28
#define	ARCHIVE_ENTRY_H_INCLUDED
28
#define	ARCHIVE_ENTRY_H_INCLUDED
29
29
30
/* Note: Compiler will complain if this does not match archive.h! */
30
/* Note: Compiler will complain if this does not match archive.h! */
31
#define	ARCHIVE_VERSION_NUMBER 3007004
31
#define	ARCHIVE_VERSION_NUMBER 3007007
32
32
33
/*
33
/*
34
 * Note: archive_entry.h is for use outside of libarchive; the
34
 * Note: archive_entry.h is for use outside of libarchive; the
Lines 259-267 __LA_DECL int archive_entry_gid_is_set(struct archive_entry *); Link Here
259
__LA_DECL const char	*archive_entry_gname(struct archive_entry *);
259
__LA_DECL const char	*archive_entry_gname(struct archive_entry *);
260
__LA_DECL const char	*archive_entry_gname_utf8(struct archive_entry *);
260
__LA_DECL const char	*archive_entry_gname_utf8(struct archive_entry *);
261
__LA_DECL const wchar_t	*archive_entry_gname_w(struct archive_entry *);
261
__LA_DECL const wchar_t	*archive_entry_gname_w(struct archive_entry *);
262
__LA_DECL void		 archive_entry_set_link_to_hardlink(struct archive_entry *);
262
__LA_DECL const char	*archive_entry_hardlink(struct archive_entry *);
263
__LA_DECL const char	*archive_entry_hardlink(struct archive_entry *);
263
__LA_DECL const char	*archive_entry_hardlink_utf8(struct archive_entry *);
264
__LA_DECL const char	*archive_entry_hardlink_utf8(struct archive_entry *);
264
__LA_DECL const wchar_t	*archive_entry_hardlink_w(struct archive_entry *);
265
__LA_DECL const wchar_t	*archive_entry_hardlink_w(struct archive_entry *);
266
__LA_DECL int		 archive_entry_hardlink_is_set(struct archive_entry *);
265
__LA_DECL la_int64_t	 archive_entry_ino(struct archive_entry *);
267
__LA_DECL la_int64_t	 archive_entry_ino(struct archive_entry *);
266
__LA_DECL la_int64_t	 archive_entry_ino64(struct archive_entry *);
268
__LA_DECL la_int64_t	 archive_entry_ino64(struct archive_entry *);
267
__LA_DECL int		 archive_entry_ino_is_set(struct archive_entry *);
269
__LA_DECL int		 archive_entry_ino_is_set(struct archive_entry *);
Lines 275-280 __LA_DECL const char *archive_entry_pathname_utf8(struct archive_entry *); Link Here
275
__LA_DECL const wchar_t	*archive_entry_pathname_w(struct archive_entry *);
277
__LA_DECL const wchar_t	*archive_entry_pathname_w(struct archive_entry *);
276
__LA_DECL __LA_MODE_T	 archive_entry_perm(struct archive_entry *);
278
__LA_DECL __LA_MODE_T	 archive_entry_perm(struct archive_entry *);
277
__LA_DECL int		 archive_entry_perm_is_set(struct archive_entry *);
279
__LA_DECL int		 archive_entry_perm_is_set(struct archive_entry *);
280
__LA_DECL int		 archive_entry_rdev_is_set(struct archive_entry *);
278
__LA_DECL dev_t		 archive_entry_rdev(struct archive_entry *);
281
__LA_DECL dev_t		 archive_entry_rdev(struct archive_entry *);
279
__LA_DECL dev_t		 archive_entry_rdevmajor(struct archive_entry *);
282
__LA_DECL dev_t		 archive_entry_rdevmajor(struct archive_entry *);
280
__LA_DECL dev_t		 archive_entry_rdevminor(struct archive_entry *);
283
__LA_DECL dev_t		 archive_entry_rdevminor(struct archive_entry *);
Lines 283-288 __LA_DECL const wchar_t *archive_entry_sourcepath_w(struct archive_entry *); Link Here
283
__LA_DECL la_int64_t	 archive_entry_size(struct archive_entry *);
286
__LA_DECL la_int64_t	 archive_entry_size(struct archive_entry *);
284
__LA_DECL int		 archive_entry_size_is_set(struct archive_entry *);
287
__LA_DECL int		 archive_entry_size_is_set(struct archive_entry *);
285
__LA_DECL const char	*archive_entry_strmode(struct archive_entry *);
288
__LA_DECL const char	*archive_entry_strmode(struct archive_entry *);
289
__LA_DECL void		 archive_entry_set_link_to_symlink(struct archive_entry *);
286
__LA_DECL const char	*archive_entry_symlink(struct archive_entry *);
290
__LA_DECL const char	*archive_entry_symlink(struct archive_entry *);
287
__LA_DECL const char	*archive_entry_symlink_utf8(struct archive_entry *);
291
__LA_DECL const char	*archive_entry_symlink_utf8(struct archive_entry *);
288
__LA_DECL int		 archive_entry_symlink_type(struct archive_entry *);
292
__LA_DECL int		 archive_entry_symlink_type(struct archive_entry *);
Lines 324-329 __LA_DECL void archive_entry_set_fflags(struct archive_entry *, Link Here
324
/* Note that all recognized tokens are processed, regardless. */
328
/* Note that all recognized tokens are processed, regardless. */
325
__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
329
__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
326
	    const char *);
330
	    const char *);
331
__LA_DECL const char *archive_entry_copy_fflags_text_len(struct archive_entry *,
332
	    const char *, size_t);
327
__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
333
__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
328
	    const wchar_t *);
334
	    const wchar_t *);
329
__LA_DECL void	archive_entry_set_gid(struct archive_entry *, la_int64_t);
335
__LA_DECL void	archive_entry_set_gid(struct archive_entry *, la_int64_t);
(-)b/contrib/libarchive/libarchive/archive_entry_link_resolver.c (+15 lines)
Lines 201-216 archive_entry_linkify(struct archive_entry_linkresolver *res, Link Here
201
		le = find_entry(res, *e);
201
		le = find_entry(res, *e);
202
		if (le != NULL) {
202
		if (le != NULL) {
203
			archive_entry_unset_size(*e);
203
			archive_entry_unset_size(*e);
204
#if defined(_WIN32) && !defined(__CYGWIN__)
205
			archive_entry_copy_hardlink_w(*e,
206
			    archive_entry_pathname_w(le->canonical));
207
#else
204
			archive_entry_copy_hardlink(*e,
208
			archive_entry_copy_hardlink(*e,
205
			    archive_entry_pathname(le->canonical));
209
			    archive_entry_pathname(le->canonical));
210
#endif
206
		} else
211
		} else
207
			insert_entry(res, *e);
212
			insert_entry(res, *e);
208
		return;
213
		return;
209
	case ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE:
214
	case ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE:
210
		le = find_entry(res, *e);
215
		le = find_entry(res, *e);
211
		if (le != NULL) {
216
		if (le != NULL) {
217
#if defined(_WIN32) && !defined(__CYGWIN__)
218
			archive_entry_copy_hardlink_w(*e,
219
			    archive_entry_pathname_w(le->canonical));
220
#else
212
			archive_entry_copy_hardlink(*e,
221
			archive_entry_copy_hardlink(*e,
213
			    archive_entry_pathname(le->canonical));
222
			    archive_entry_pathname(le->canonical));
223
#endif
214
		} else
224
		} else
215
			insert_entry(res, *e);
225
			insert_entry(res, *e);
216
		return;
226
		return;
Lines 229-236 archive_entry_linkify(struct archive_entry_linkresolver *res, Link Here
229
			le->entry = t;
239
			le->entry = t;
230
			/* Make the old entry into a hardlink. */
240
			/* Make the old entry into a hardlink. */
231
			archive_entry_unset_size(*e);
241
			archive_entry_unset_size(*e);
242
#if defined(_WIN32) && !defined(__CYGWIN__)
243
			archive_entry_copy_hardlink_w(*e,
244
			    archive_entry_pathname_w(le->canonical));
245
#else
232
			archive_entry_copy_hardlink(*e,
246
			archive_entry_copy_hardlink(*e,
233
			    archive_entry_pathname(le->canonical));
247
			    archive_entry_pathname(le->canonical));
248
#endif
234
			/* If we ran out of links, return the
249
			/* If we ran out of links, return the
235
			 * final entry as well. */
250
			 * final entry as well. */
236
			if (le->links == 0) {
251
			if (le->links == 0) {
(-)b/contrib/libarchive/libarchive/archive_entry_perms.3 (+1 lines)
Lines 150-155 character strings at the same time. Link Here
150
.Fn archive_entry_set_XXX
150
.Fn archive_entry_set_XXX
151
is an alias for
151
is an alias for
152
.Fn archive_entry_copy_XXX .
152
.Fn archive_entry_copy_XXX .
153
The strings are copied, and don't need to outlive the call.
153
.Ss File Flags
154
.Ss File Flags
154
File flags are transparently converted between a bitmap
155
File flags are transparently converted between a bitmap
155
representation and a textual format.
156
representation and a textual format.
(-)b/contrib/libarchive/libarchive/archive_entry_private.h (-2 / +2 lines)
Lines 149-154 struct archive_entry { Link Here
149
#define	AE_SET_FILETYPE	1024
149
#define	AE_SET_FILETYPE	1024
150
#define	AE_SET_UID	2048
150
#define	AE_SET_UID	2048
151
#define	AE_SET_GID	4096
151
#define	AE_SET_GID	4096
152
#define	AE_SET_RDEV	8192
152
153
153
	/*
154
	/*
154
	 * Use aes here so that we get transparent mbs<->wcs conversions.
155
	 * Use aes here so that we get transparent mbs<->wcs conversions.
Lines 157-165 struct archive_entry { Link Here
157
	unsigned long ae_fflags_set;		/* Bitmap fflags */
158
	unsigned long ae_fflags_set;		/* Bitmap fflags */
158
	unsigned long ae_fflags_clear;
159
	unsigned long ae_fflags_clear;
159
	struct archive_mstring ae_gname;		/* Name of owning group */
160
	struct archive_mstring ae_gname;		/* Name of owning group */
160
	struct archive_mstring ae_hardlink;	/* Name of target for hardlink */
161
	struct archive_mstring ae_linkname;	/* Name of target for hardlink or symlink */
161
	struct archive_mstring ae_pathname;	/* Name of entry */
162
	struct archive_mstring ae_pathname;	/* Name of entry */
162
	struct archive_mstring ae_symlink;		/* symlink contents */
163
	struct archive_mstring ae_uname;		/* Name of owner */
163
	struct archive_mstring ae_uname;		/* Name of owner */
164
164
165
	/* Not used within libarchive; useful for some clients. */
165
	/* Not used within libarchive; useful for some clients. */
(-)b/contrib/libarchive/libarchive/archive_entry_sparse.c (-1 / +1 lines)
Lines 76-82 archive_entry_sparse_add_entry(struct archive_entry *entry, Link Here
76
		}
76
		}
77
	}
77
	}
78
78
79
	if ((sp = (struct ae_sparse *)malloc(sizeof(*sp))) == NULL)
79
	if ((sp = malloc(sizeof(*sp))) == NULL)
80
		/* XXX Error XXX */
80
		/* XXX Error XXX */
81
		return;
81
		return;
82
82
(-)b/contrib/libarchive/libarchive/archive_entry_xattr.c (-1 / +1 lines)
Lines 90-96 archive_entry_xattr_add_entry(struct archive_entry *entry, Link Here
90
{
90
{
91
	struct ae_xattr	*xp;
91
	struct ae_xattr	*xp;
92
92
93
	if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL)
93
	if ((xp = malloc(sizeof(struct ae_xattr))) == NULL)
94
		__archive_errx(1, "Out of memory");
94
		__archive_errx(1, "Out of memory");
95
95
96
	if ((xp->name = strdup(name)) == NULL)
96
	if ((xp->name = strdup(name)) == NULL)
(-)b/contrib/libarchive/libarchive/archive_hmac.c (-1 / +1 lines)
Lines 74-80 __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) Link Here
74
	memset(ctx, 0, sizeof(*ctx));
74
	memset(ctx, 0, sizeof(*ctx));
75
}
75
}
76
76
77
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
77
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
78
78
79
#ifndef BCRYPT_HASH_REUSABLE_FLAG
79
#ifndef BCRYPT_HASH_REUSABLE_FLAG
80
# define BCRYPT_HASH_REUSABLE_FLAG 0x00000020
80
# define BCRYPT_HASH_REUSABLE_FLAG 0x00000020
(-)b/contrib/libarchive/libarchive/archive_hmac_private.h (-1 / +1 lines)
Lines 52-58 int __libarchive_hmac_build_hack(void); Link Here
52
52
53
typedef	CCHmacContext archive_hmac_sha1_ctx;
53
typedef	CCHmacContext archive_hmac_sha1_ctx;
54
54
55
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
55
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
56
#include <bcrypt.h>
56
#include <bcrypt.h>
57
57
58
typedef struct {
58
typedef struct {
(-)b/contrib/libarchive/libarchive/archive_match.c (-1 / +1 lines)
Lines 220-226 archive_match_new(void) Link Here
220
{
220
{
221
	struct archive_match *a;
221
	struct archive_match *a;
222
222
223
	a = (struct archive_match *)calloc(1, sizeof(*a));
223
	a = calloc(1, sizeof(*a));
224
	if (a == NULL)
224
	if (a == NULL)
225
		return (NULL);
225
		return (NULL);
226
	a->archive.magic = ARCHIVE_MATCH_MAGIC;
226
	a->archive.magic = ARCHIVE_MATCH_MAGIC;
(-)b/contrib/libarchive/libarchive/archive_openssl_evp_private.h (-1 / +1 lines)
Lines 39-45 Link Here
39
#include <string.h> /* memset */
39
#include <string.h> /* memset */
40
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
40
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
41
{
41
{
42
	EVP_MD_CTX *ctx = (EVP_MD_CTX *)calloc(1, sizeof(EVP_MD_CTX));
42
	EVP_MD_CTX *ctx = calloc(1, sizeof(EVP_MD_CTX));
43
	return ctx;
43
	return ctx;
44
}
44
}
45
45
(-)b/contrib/libarchive/libarchive/archive_openssl_hmac_private.h (-1 / +1 lines)
Lines 39-45 Link Here
39
#include <string.h> /* memset */
39
#include <string.h> /* memset */
40
static inline HMAC_CTX *HMAC_CTX_new(void)
40
static inline HMAC_CTX *HMAC_CTX_new(void)
41
{
41
{
42
	HMAC_CTX *ctx = (HMAC_CTX *)calloc(1, sizeof(HMAC_CTX));
42
	HMAC_CTX *ctx = calloc(1, sizeof(HMAC_CTX));
43
	return ctx;
43
	return ctx;
44
}
44
}
45
45
(-)b/contrib/libarchive/libarchive/archive_ppmd7.c (-1 / +1 lines)
Lines 138-144 static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size) Link Here
138
      #else
138
      #else
139
        4 - (size & 3);
139
        4 - (size & 3);
140
      #endif
140
      #endif
141
    if ((p->Base = (Byte *)malloc(p->AlignOffset + size
141
    if ((p->Base = malloc(p->AlignOffset + size
142
        #ifndef PPMD_32BIT
142
        #ifndef PPMD_32BIT
143
        + UNIT_SIZE
143
        + UNIT_SIZE
144
        #endif
144
        #endif
(-)b/contrib/libarchive/libarchive/archive_ppmd8.c (-4 / +3 lines)
Lines 107-113 Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size) Link Here
107
      #else
107
      #else
108
        4 - (size & 3);
108
        4 - (size & 3);
109
      #endif
109
      #endif
110
    if ((p->Base = (Byte *)malloc(p->AlignOffset + size)) == 0)
110
    if ((p->Base = malloc(p->AlignOffset + size)) == 0)
111
      return False;
111
      return False;
112
    p->Size = size;
112
    p->Size = size;
113
  }
113
  }
Lines 671-677 static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c Link Here
671
    upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
671
    upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
672
  }
672
  }
673
673
674
  do
674
  while (numPs != 0)
675
  {
675
  {
676
    /* Create Child */
676
    /* Create Child */
677
    CTX_PTR c1; /* = AllocContext(p); */
677
    CTX_PTR c1; /* = AllocContext(p); */
Lines 692-699 static CTX_PTR CreateSuccessors(CPpmd8 *p, Bool skip, CPpmd_State *s1, CTX_PTR c Link Here
692
    SetSuccessor(ps[--numPs], REF(c1));
692
    SetSuccessor(ps[--numPs], REF(c1));
693
    c = c1;
693
    c = c1;
694
  }
694
  }
695
  while (numPs != 0);
695
696
  
697
  return c;
696
  return c;
698
}
697
}
699
698
(-)b/contrib/libarchive/libarchive/archive_private.h (-2 / +4 lines)
Lines 27-34 Link Here
27
#define ARCHIVE_PRIVATE_H_INCLUDED
27
#define ARCHIVE_PRIVATE_H_INCLUDED
28
28
29
#ifndef __LIBARCHIVE_BUILD
29
#ifndef __LIBARCHIVE_BUILD
30
#ifndef __LIBARCHIVE_TEST
30
#error This header is only to be used internally to libarchive.
31
#error This header is only to be used internally to libarchive.
31
#endif
32
#endif
33
#endif
32
34
33
#if HAVE_ICONV_H
35
#if HAVE_ICONV_H
34
#include <iconv.h>
36
#include <iconv.h>
Lines 158-166 __LA_NORETURN void __archive_errx(int retvalue, const char *msg); Link Here
158
void	__archive_ensure_cloexec_flag(int fd);
160
void	__archive_ensure_cloexec_flag(int fd);
159
int	__archive_mktemp(const char *tmpdir);
161
int	__archive_mktemp(const char *tmpdir);
160
#if defined(_WIN32) && !defined(__CYGWIN__)
162
#if defined(_WIN32) && !defined(__CYGWIN__)
161
int	__archive_mkstemp(wchar_t *template);
163
int	__archive_mkstemp(wchar_t *templates);
162
#else
164
#else
163
int	__archive_mkstemp(char *template);
165
int	__archive_mkstemp(char *templates);
164
#endif
166
#endif
165
167
166
int	__archive_clean(struct archive *);
168
int	__archive_clean(struct archive *);
(-)b/contrib/libarchive/libarchive/archive_read.c (-4 / +4 lines)
Lines 92-98 archive_read_new(void) Link Here
92
{
92
{
93
	struct archive_read *a;
93
	struct archive_read *a;
94
94
95
	a = (struct archive_read *)calloc(1, sizeof(*a));
95
	a = calloc(1, sizeof(*a));
96
	if (a == NULL)
96
	if (a == NULL)
97
		return (NULL);
97
		return (NULL);
98
	a->archive.magic = ARCHIVE_READ_MAGIC;
98
	a->archive.magic = ARCHIVE_READ_MAGIC;
Lines 582-588 choose_filters(struct archive_read *a) Link Here
582
		}
582
		}
583
583
584
		filter
584
		filter
585
		    = (struct archive_read_filter *)calloc(1, sizeof(*filter));
585
		    = calloc(1, sizeof(*filter));
586
		if (filter == NULL)
586
		if (filter == NULL)
587
			return (ARCHIVE_FATAL);
587
			return (ARCHIVE_FATAL);
588
		filter->bidder = best_bidder;
588
		filter->bidder = best_bidder;
Lines 1382-1388 __archive_read_filter_ahead(struct archive_read_filter *filter, Link Here
1382
		if (filter->client_avail <= 0) {
1382
		if (filter->client_avail <= 0) {
1383
			if (filter->end_of_file) {
1383
			if (filter->end_of_file) {
1384
				if (avail != NULL)
1384
				if (avail != NULL)
1385
					*avail = 0;
1385
					*avail = filter->avail;
1386
				return (NULL);
1386
				return (NULL);
1387
			}
1387
			}
1388
			bytes_read = (filter->vtable->read)(filter,
1388
			bytes_read = (filter->vtable->read)(filter,
Lines 1451-1457 __archive_read_filter_ahead(struct archive_read_filter *filter, Link Here
1451
					s = t;
1451
					s = t;
1452
				}
1452
				}
1453
				/* Now s >= min, so allocate a new buffer. */
1453
				/* Now s >= min, so allocate a new buffer. */
1454
				p = (char *)malloc(s);
1454
				p = malloc(s);
1455
				if (p == NULL) {
1455
				if (p == NULL) {
1456
					archive_set_error(
1456
					archive_set_error(
1457
						&filter->archive->archive,
1457
						&filter->archive->archive,
(-)b/contrib/libarchive/libarchive/archive_read_append_filter.c (-5 / +3 lines)
Lines 111-117 archive_read_append_filter(struct archive *_a, int code) Link Here
111
    number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]);
111
    number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]);
112
112
113
    bidder = a->bidders;
113
    bidder = a->bidders;
114
    for (i = 0; i < number_bidders; i++, bidder++)
114
    for (i = 1; i < number_bidders; i++, bidder++)
115
    {
115
    {
116
      if (!bidder->name || !strcmp(bidder->name, str))
116
      if (!bidder->name || !strcmp(bidder->name, str))
117
        break;
117
        break;
Lines 123-130 archive_read_append_filter(struct archive *_a, int code) Link Here
123
      return (ARCHIVE_FATAL);
123
      return (ARCHIVE_FATAL);
124
    }
124
    }
125
125
126
    filter
126
    filter = calloc(1, sizeof(*filter));
127
        = (struct archive_read_filter *)calloc(1, sizeof(*filter));
128
    if (filter == NULL)
127
    if (filter == NULL)
129
    {
128
    {
130
      archive_set_error(&a->archive, ENOMEM, "Out of memory");
129
      archive_set_error(&a->archive, ENOMEM, "Out of memory");
Lines 180-187 archive_read_append_filter_program_signature(struct archive *_a, Link Here
180
    return (ARCHIVE_FATAL);
179
    return (ARCHIVE_FATAL);
181
  }
180
  }
182
181
183
  filter
182
  filter = calloc(1, sizeof(*filter));
184
      = (struct archive_read_filter *)calloc(1, sizeof(*filter));
185
  if (filter == NULL)
183
  if (filter == NULL)
186
  {
184
  {
187
    archive_set_error(&a->archive, ENOMEM, "Out of memory");
185
    archive_set_error(&a->archive, ENOMEM, "Out of memory");
(-)b/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c (+1 lines)
Lines 520-525 setup_xattr(struct archive_read_disk *a, Link Here
520
	if (size == -1) {
520
	if (size == -1) {
521
		archive_set_error(&a->archive, errno,
521
		archive_set_error(&a->archive, errno,
522
		    "Couldn't read extended attribute");
522
		    "Couldn't read extended attribute");
523
		free(value);
523
		return (ARCHIVE_WARN);
524
		return (ARCHIVE_WARN);
524
	}
525
	}
525
526
(-)b/contrib/libarchive/libarchive/archive_read_disk_posix.c (-1 / +1 lines)
Lines 451-457 archive_read_disk_new(void) Link Here
451
{
451
{
452
	struct archive_read_disk *a;
452
	struct archive_read_disk *a;
453
453
454
	a = (struct archive_read_disk *)calloc(1, sizeof(*a));
454
	a = calloc(1, sizeof(*a));
455
	if (a == NULL)
455
	if (a == NULL)
456
		return (NULL);
456
		return (NULL);
457
	a->archive.magic = ARCHIVE_READ_DISK_MAGIC;
457
	a->archive.magic = ARCHIVE_READ_DISK_MAGIC;
(-)b/contrib/libarchive/libarchive/archive_read_extract2.c (-1 / +1 lines)
Lines 51-57 struct archive_read_extract * Link Here
51
__archive_read_get_extract(struct archive_read *a)
51
__archive_read_get_extract(struct archive_read *a)
52
{
52
{
53
	if (a->extract == NULL) {
53
	if (a->extract == NULL) {
54
		a->extract = (struct archive_read_extract *)calloc(1, sizeof(*a->extract));
54
		a->extract = calloc(1, sizeof(*a->extract));
55
		if (a->extract == NULL) {
55
		if (a->extract == NULL) {
56
			archive_set_error(&a->archive, ENOMEM, "Can't extract");
56
			archive_set_error(&a->archive, ENOMEM, "Can't extract");
57
			return (NULL);
57
			return (NULL);
(-)b/contrib/libarchive/libarchive/archive_read_open_fd.c (-1 / +1 lines)
Lines 74-80 archive_read_open_fd(struct archive *a, int fd, size_t block_size) Link Here
74
		return (ARCHIVE_FATAL);
74
		return (ARCHIVE_FATAL);
75
	}
75
	}
76
76
77
	mine = (struct read_fd_data *)calloc(1, sizeof(*mine));
77
	mine = calloc(1, sizeof(*mine));
78
	b = malloc(block_size);
78
	b = malloc(block_size);
79
	if (mine == NULL || b == NULL) {
79
	if (mine == NULL || b == NULL) {
80
		archive_set_error(a, ENOMEM, "No memory");
80
		archive_set_error(a, ENOMEM, "No memory");
(-)b/contrib/libarchive/libarchive/archive_read_open_file.c (-1 / +1 lines)
Lines 69-75 archive_read_open_FILE(struct archive *a, FILE *f) Link Here
69
	void *b;
69
	void *b;
70
70
71
	archive_clear_error(a);
71
	archive_clear_error(a);
72
	mine = (struct read_FILE_data *)malloc(sizeof(*mine));
72
	mine = malloc(sizeof(*mine));
73
	b = malloc(block_size);
73
	b = malloc(block_size);
74
	if (mine == NULL || b == NULL) {
74
	if (mine == NULL || b == NULL) {
75
		archive_set_error(a, ENOMEM, "No memory");
75
		archive_set_error(a, ENOMEM, "No memory");
(-)b/contrib/libarchive/libarchive/archive_read_open_filename.c (-2 / +2 lines)
Lines 122-128 archive_read_open_filenames(struct archive *a, const char **filenames, Link Here
122
	{
122
	{
123
		if (filename == NULL)
123
		if (filename == NULL)
124
			filename = "";
124
			filename = "";
125
		mine = (struct read_file_data *)calloc(1,
125
		mine = calloc(1,
126
			sizeof(*mine) + strlen(filename));
126
			sizeof(*mine) + strlen(filename));
127
		if (mine == NULL)
127
		if (mine == NULL)
128
			goto no_memory;
128
			goto no_memory;
Lines 175-181 archive_read_open_filenames_w(struct archive *a, const wchar_t **wfilenames, Link Here
175
	{
175
	{
176
		if (wfilename == NULL)
176
		if (wfilename == NULL)
177
			wfilename = L"";
177
			wfilename = L"";
178
		mine = (struct read_file_data *)calloc(1,
178
		mine = calloc(1,
179
			sizeof(*mine) + wcslen(wfilename) * sizeof(wchar_t));
179
			sizeof(*mine) + wcslen(wfilename) * sizeof(wchar_t));
180
		if (mine == NULL)
180
		if (mine == NULL)
181
			goto no_memory;
181
			goto no_memory;
(-)b/contrib/libarchive/libarchive/archive_read_open_memory.c (-1 / +1 lines)
Lines 69-75 archive_read_open_memory2(struct archive *a, const void *buff, Link Here
69
{
69
{
70
	struct read_memory_data *mine;
70
	struct read_memory_data *mine;
71
71
72
	mine = (struct read_memory_data *)calloc(1, sizeof(*mine));
72
	mine = calloc(1, sizeof(*mine));
73
	if (mine == NULL) {
73
	if (mine == NULL) {
74
		archive_set_error(a, ENOMEM, "No memory");
74
		archive_set_error(a, ENOMEM, "No memory");
75
		return (ARCHIVE_FATAL);
75
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_bzip2.c (-2 / +2 lines)
Lines 190-197 bzip2_reader_init(struct archive_read_filter *self) Link Here
190
	self->code = ARCHIVE_FILTER_BZIP2;
190
	self->code = ARCHIVE_FILTER_BZIP2;
191
	self->name = "bzip2";
191
	self->name = "bzip2";
192
192
193
	state = (struct private_data *)calloc(1, sizeof(*state));
193
	state = calloc(1, sizeof(*state));
194
	out_block = (unsigned char *)malloc(out_block_size);
194
	out_block = malloc(out_block_size);
195
	if (state == NULL || out_block == NULL) {
195
	if (state == NULL || out_block == NULL) {
196
		archive_set_error(&self->archive->archive, ENOMEM,
196
		archive_set_error(&self->archive->archive, ENOMEM,
197
		    "Can't allocate data for bzip2 decompression");
197
		    "Can't allocate data for bzip2 decompression");
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_compress.c (-1 / +1 lines)
Lines 217-223 compress_bidder_init(struct archive_read_filter *self) Link Here
217
	self->code = ARCHIVE_FILTER_COMPRESS;
217
	self->code = ARCHIVE_FILTER_COMPRESS;
218
	self->name = "compress (.Z)";
218
	self->name = "compress (.Z)";
219
219
220
	state = (struct private_data *)calloc(1, sizeof(*state));
220
	state = calloc(1, sizeof(*state));
221
	out_block = malloc(out_block_size);
221
	out_block = malloc(out_block_size);
222
	if (state == NULL || out_block == NULL) {
222
	if (state == NULL || out_block == NULL) {
223
		free(out_block);
223
		free(out_block);
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_gzip.c (-4 / +14 lines)
Lines 123-128 archive_read_support_filter_gzip(struct archive *_a) Link Here
123
 * number of bytes in header.  If pbits is non-NULL, it receives a
123
 * number of bytes in header.  If pbits is non-NULL, it receives a
124
 * count of bits verified, suitable for use by bidder.
124
 * count of bits verified, suitable for use by bidder.
125
 */
125
 */
126
#define MAX_FILENAME_LENGTH (1024 * 1024L)
127
#define MAX_COMMENT_LENGTH (1024 * 1024L)
126
static ssize_t
128
static ssize_t
127
peek_at_header(struct archive_read_filter *filter, int *pbits,
129
peek_at_header(struct archive_read_filter *filter, int *pbits,
128
#ifdef HAVE_ZLIB_H
130
#ifdef HAVE_ZLIB_H
Lines 180-188 peek_at_header(struct archive_read_filter *filter, int *pbits, Link Here
180
#endif
182
#endif
181
		do {
183
		do {
182
			++len;
184
			++len;
183
			if (avail < len)
185
			if (avail < len) {
186
				if (avail > MAX_FILENAME_LENGTH) {
187
					return (0);
188
				}
184
				p = __archive_read_filter_ahead(filter,
189
				p = __archive_read_filter_ahead(filter,
185
				    len, &avail);
190
				    len, &avail);
191
			}
186
			if (p == NULL)
192
			if (p == NULL)
187
				return (0);
193
				return (0);
188
		} while (p[len - 1] != 0);
194
		} while (p[len - 1] != 0);
Lines 200-208 peek_at_header(struct archive_read_filter *filter, int *pbits, Link Here
200
	if (header_flags & 16) {
206
	if (header_flags & 16) {
201
		do {
207
		do {
202
			++len;
208
			++len;
203
			if (avail < len)
209
			if (avail < len) {
210
				if (avail > MAX_COMMENT_LENGTH) {
211
					return (0);
212
				}
204
				p = __archive_read_filter_ahead(filter,
213
				p = __archive_read_filter_ahead(filter,
205
				    len, &avail);
214
				    len, &avail);
215
			}
206
			if (p == NULL)
216
			if (p == NULL)
207
				return (0);
217
				return (0);
208
		} while (p[len - 1] != 0);
218
		} while (p[len - 1] != 0);
Lines 307-314 gzip_bidder_init(struct archive_read_filter *self) Link Here
307
	self->code = ARCHIVE_FILTER_GZIP;
317
	self->code = ARCHIVE_FILTER_GZIP;
308
	self->name = "gzip";
318
	self->name = "gzip";
309
319
310
	state = (struct private_data *)calloc(1, sizeof(*state));
320
	state = calloc(1, sizeof(*state));
311
	out_block = (unsigned char *)malloc(out_block_size);
321
	out_block = malloc(out_block_size);
312
	if (state == NULL || out_block == NULL) {
322
	if (state == NULL || out_block == NULL) {
313
		free(out_block);
323
		free(out_block);
314
		free(state);
324
		free(state);
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c (-3 / +3 lines)
Lines 223-229 lz4_reader_init(struct archive_read_filter *self) Link Here
223
	self->code = ARCHIVE_FILTER_LZ4;
223
	self->code = ARCHIVE_FILTER_LZ4;
224
	self->name = "lz4";
224
	self->name = "lz4";
225
225
226
	state = (struct private_data *)calloc(1, sizeof(*state));
226
	state = calloc(1, sizeof(*state));
227
	if (state == NULL) {
227
	if (state == NULL) {
228
		archive_set_error(&self->archive->archive, ENOMEM,
228
		archive_set_error(&self->archive->archive, ENOMEM,
229
		    "Can't allocate data for lz4 decompression");
229
		    "Can't allocate data for lz4 decompression");
Lines 248-254 lz4_allocate_out_block(struct archive_read_filter *self) Link Here
248
		out_block_size += 64 * 1024;
248
		out_block_size += 64 * 1024;
249
	if (state->out_block_size < out_block_size) {
249
	if (state->out_block_size < out_block_size) {
250
		free(state->out_block);
250
		free(state->out_block);
251
		out_block = (unsigned char *)malloc(out_block_size);
251
		out_block = malloc(out_block_size);
252
		state->out_block_size = out_block_size;
252
		state->out_block_size = out_block_size;
253
		if (out_block == NULL) {
253
		if (out_block == NULL) {
254
			archive_set_error(&self->archive->archive, ENOMEM,
254
			archive_set_error(&self->archive->archive, ENOMEM,
Lines 271-277 lz4_allocate_out_block_for_legacy(struct archive_read_filter *self) Link Here
271
271
272
	if (state->out_block_size < out_block_size) {
272
	if (state->out_block_size < out_block_size) {
273
		free(state->out_block);
273
		free(state->out_block);
274
		out_block = (unsigned char *)malloc(out_block_size);
274
		out_block = malloc(out_block_size);
275
		state->out_block_size = out_block_size;
275
		state->out_block_size = out_block_size;
276
		if (out_block == NULL) {
276
		if (out_block == NULL) {
277
			archive_set_error(&self->archive->archive, ENOMEM,
277
			archive_set_error(&self->archive->archive, ENOMEM,
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c (-2 / +3 lines)
Lines 185-191 lzop_bidder_init(struct archive_read_filter *self) Link Here
185
	self->code = ARCHIVE_FILTER_LZOP;
185
	self->code = ARCHIVE_FILTER_LZOP;
186
	self->name = "lzop";
186
	self->name = "lzop";
187
187
188
	state = (struct read_lzop *)calloc(1, sizeof(*state));
188
	state = calloc(1, sizeof(*state));
189
	if (state == NULL) {
189
	if (state == NULL) {
190
		archive_set_error(&self->archive->archive, ENOMEM,
190
		archive_set_error(&self->archive->archive, ENOMEM,
191
		    "Can't allocate data for lzop decompression");
191
		    "Can't allocate data for lzop decompression");
Lines 291-297 consume_header(struct archive_read_filter *self) Link Here
291
		if (p == NULL)
291
		if (p == NULL)
292
			goto truncated;
292
			goto truncated;
293
		len = archive_be32dec(p);
293
		len = archive_be32dec(p);
294
		__archive_read_filter_consume(self->upstream, len + 4 + 4);
294
		__archive_read_filter_consume(self->upstream,
295
		    (int64_t)len + 4 + 4);
295
	}
296
	}
296
	state->flags = flags;
297
	state->flags = flags;
297
	state->in_stream = 1;
298
	state->in_stream = 1;
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_program.c (-3 / +3 lines)
Lines 139-145 archive_read_support_filter_program_signature(struct archive *_a, Link Here
139
	/*
139
	/*
140
	 * Allocate our private state.
140
	 * Allocate our private state.
141
	 */
141
	 */
142
	state = (struct program_bidder *)calloc(1, sizeof (*state));
142
	state = calloc(1, sizeof (*state));
143
	if (state == NULL)
143
	if (state == NULL)
144
		goto memerr;
144
		goto memerr;
145
	state->cmd = strdup(cmd);
145
	state->cmd = strdup(cmd);
Lines 398-405 __archive_read_program(struct archive_read_filter *self, const char *cmd) Link Here
398
	size_t l;
398
	size_t l;
399
399
400
	l = strlen(prefix) + strlen(cmd) + 1;
400
	l = strlen(prefix) + strlen(cmd) + 1;
401
	state = (struct program_filter *)calloc(1, sizeof(*state));
401
	state = calloc(1, sizeof(*state));
402
	out_buf = (char *)malloc(out_buf_len);
402
	out_buf = malloc(out_buf_len);
403
	if (state == NULL || out_buf == NULL ||
403
	if (state == NULL || out_buf == NULL ||
404
	    archive_string_ensure(&state->description, l) == NULL) {
404
	    archive_string_ensure(&state->description, l) == NULL) {
405
		archive_set_error(&self->archive->archive, ENOMEM,
405
		archive_set_error(&self->archive->archive, ENOMEM,
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c (-19 / +26 lines)
Lines 39-46 Link Here
39
39
40
struct rpm {
40
struct rpm {
41
	int64_t		 total_in;
41
	int64_t		 total_in;
42
	size_t		 hpos;
42
	uint64_t	 hpos;
43
	size_t		 hlen;
43
	uint64_t	 hlen;
44
	unsigned char	 header[16];
44
	unsigned char	 header[16];
45
	enum {
45
	enum {
46
		ST_LEAD,	/* Skipping 'Lead' section. */
46
		ST_LEAD,	/* Skipping 'Lead' section. */
Lines 53-59 struct rpm { Link Here
53
	}		 state;
53
	}		 state;
54
	int		 first_header;
54
	int		 first_header;
55
};
55
};
56
#define RPM_LEAD_SIZE	96	/* Size of 'Lead' section. */
56
#define RPM_LEAD_SIZE		96	/* Size of 'Lead' section. */
57
#define RPM_MIN_HEAD_SIZE	16	/* Minimum size of 'Head'. */
57
58
58
static int	rpm_bidder_bid(struct archive_read_filter_bidder *,
59
static int	rpm_bidder_bid(struct archive_read_filter_bidder *,
59
		    struct archive_read_filter *);
60
		    struct archive_read_filter *);
Lines 63-68 static ssize_t rpm_filter_read(struct archive_read_filter *, Link Here
63
		    const void **);
64
		    const void **);
64
static int	rpm_filter_close(struct archive_read_filter *);
65
static int	rpm_filter_close(struct archive_read_filter *);
65
66
67
static inline size_t rpm_limit_bytes(uint64_t, size_t);
68
66
#if ARCHIVE_VERSION_NUMBER < 4000000
69
#if ARCHIVE_VERSION_NUMBER < 4000000
67
/* Deprecated; remove in libarchive 4.0 */
70
/* Deprecated; remove in libarchive 4.0 */
68
int
71
int
Lines 141-147 rpm_bidder_init(struct archive_read_filter *self) Link Here
141
	self->code = ARCHIVE_FILTER_RPM;
144
	self->code = ARCHIVE_FILTER_RPM;
142
	self->name = "rpm";
145
	self->name = "rpm";
143
146
144
	rpm = (struct rpm *)calloc(1, sizeof(*rpm));
147
	rpm = calloc(1, sizeof(*rpm));
145
	if (rpm == NULL) {
148
	if (rpm == NULL) {
146
		archive_set_error(&self->archive->archive, ENOMEM,
149
		archive_set_error(&self->archive->archive, ENOMEM,
147
		    "Can't allocate data for rpm");
150
		    "Can't allocate data for rpm");
Lines 155-169 rpm_bidder_init(struct archive_read_filter *self) Link Here
155
	return (ARCHIVE_OK);
158
	return (ARCHIVE_OK);
156
}
159
}
157
160
161
static inline size_t
162
rpm_limit_bytes(uint64_t bytes, size_t max)
163
{
164
	return (bytes > max ? max : (size_t)bytes);
165
}
166
158
static ssize_t
167
static ssize_t
159
rpm_filter_read(struct archive_read_filter *self, const void **buff)
168
rpm_filter_read(struct archive_read_filter *self, const void **buff)
160
{
169
{
161
	struct rpm *rpm;
170
	struct rpm *rpm;
162
	const unsigned char *b;
171
	const unsigned char *b;
163
	ssize_t avail_in, total;
172
	ssize_t avail_in, total, used;
164
	size_t used, n;
173
	size_t n;
165
	uint32_t section;
174
	uint64_t section;
166
	uint32_t bytes;
175
	uint64_t bytes;
167
176
168
	rpm = (struct rpm *)self->data;
177
	rpm = (struct rpm *)self->data;
169
	*buff = NULL;
178
	*buff = NULL;
Lines 197-211 rpm_filter_read(struct archive_read_filter *self, const void **buff) Link Here
197
			}
206
			}
198
			break;
207
			break;
199
		case ST_HEADER:
208
		case ST_HEADER:
200
			n = 16 - rpm->hpos;
209
			n = rpm_limit_bytes(RPM_MIN_HEAD_SIZE - rpm->hpos,
201
			if (n > avail_in - used)
210
			    avail_in - used);
202
				n = avail_in - used;
203
			memcpy(rpm->header+rpm->hpos, b, n);
211
			memcpy(rpm->header+rpm->hpos, b, n);
204
			b += n;
212
			b += n;
205
			used += n;
213
			used += n;
206
			rpm->hpos += n;
214
			rpm->hpos += n;
207
215
208
			if (rpm->hpos == 16) {
216
			if (rpm->hpos == RPM_MIN_HEAD_SIZE) {
209
				if (rpm->header[0] != 0x8e ||
217
				if (rpm->header[0] != 0x8e ||
210
				    rpm->header[1] != 0xad ||
218
				    rpm->header[1] != 0xad ||
211
				    rpm->header[2] != 0xe8 ||
219
				    rpm->header[2] != 0xe8 ||
Lines 219-239 rpm_filter_read(struct archive_read_filter *self, const void **buff) Link Here
219
					}
227
					}
220
					rpm->state = ST_ARCHIVE;
228
					rpm->state = ST_ARCHIVE;
221
					*buff = rpm->header;
229
					*buff = rpm->header;
222
					total = rpm->hpos;
230
					total = RPM_MIN_HEAD_SIZE;
223
					break;
231
					break;
224
				}
232
				}
225
				/* Calculate 'Header' length. */
233
				/* Calculate 'Header' length. */
226
				section = archive_be32dec(rpm->header+8);
234
				section = archive_be32dec(rpm->header+8);
227
				bytes = archive_be32dec(rpm->header+12);
235
				bytes = archive_be32dec(rpm->header+12);
228
				rpm->hlen = 16 + section * 16 + bytes;
236
				rpm->hlen = rpm->hpos + section * 16 + bytes;
229
				rpm->state = ST_HEADER_DATA;
237
				rpm->state = ST_HEADER_DATA;
230
				rpm->first_header = 0;
238
				rpm->first_header = 0;
231
			}
239
			}
232
			break;
240
			break;
233
		case ST_HEADER_DATA:
241
		case ST_HEADER_DATA:
234
			n = rpm->hlen - rpm->hpos;
242
			n = rpm_limit_bytes(rpm->hlen - rpm->hpos,
235
			if (n > avail_in - used)
243
			    avail_in - used);
236
				n = avail_in - used;
237
			b += n;
244
			b += n;
238
			used += n;
245
			used += n;
239
			rpm->hpos += n;
246
			rpm->hpos += n;
Lines 241-247 rpm_filter_read(struct archive_read_filter *self, const void **buff) Link Here
241
				rpm->state = ST_PADDING;
248
				rpm->state = ST_PADDING;
242
			break;
249
			break;
243
		case ST_PADDING:
250
		case ST_PADDING:
244
			while (used < (size_t)avail_in) {
251
			while (used < avail_in) {
245
				if (*b != 0) {
252
				if (*b != 0) {
246
					/* Read next header. */
253
					/* Read next header. */
247
					rpm->state = ST_HEADER;
254
					rpm->state = ST_HEADER;
Lines 259-265 rpm_filter_read(struct archive_read_filter *self, const void **buff) Link Here
259
			used = avail_in;
266
			used = avail_in;
260
			break;
267
			break;
261
		}
268
		}
262
		if (used == (size_t)avail_in) {
269
		if (used == avail_in) {
263
			rpm->total_in += used;
270
			rpm->total_in += used;
264
			__archive_read_filter_consume(self->upstream, used);
271
			__archive_read_filter_consume(self->upstream, used);
265
			b = NULL;
272
			b = NULL;
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c (-4 / +12 lines)
Lines 43-53 Link Here
43
/* Maximum lookahead during bid phase */
43
/* Maximum lookahead during bid phase */
44
#define UUENCODE_BID_MAX_READ 128*1024 /* in bytes */
44
#define UUENCODE_BID_MAX_READ 128*1024 /* in bytes */
45
45
46
#define UUENCODE_MAX_LINE_LENGTH 34*1024 /* in bytes */
47
46
struct uudecode {
48
struct uudecode {
47
	int64_t		 total;
49
	int64_t		 total;
48
	unsigned char	*in_buff;
50
	unsigned char	*in_buff;
49
#define IN_BUFF_SIZE	(1024)
51
#define IN_BUFF_SIZE	(1024)
50
	int		 in_cnt;
52
	ssize_t		 in_cnt;
51
	size_t		 in_allocated;
53
	size_t		 in_allocated;
52
	unsigned char	*out_buff;
54
	unsigned char	*out_buff;
53
#define OUT_BUFF_SIZE	(64 * 1024)
55
#define OUT_BUFF_SIZE	(64 * 1024)
Lines 373-379 uudecode_bidder_init(struct archive_read_filter *self) Link Here
373
	self->code = ARCHIVE_FILTER_UU;
375
	self->code = ARCHIVE_FILTER_UU;
374
	self->name = "uu";
376
	self->name = "uu";
375
377
376
	uudecode = (struct uudecode *)calloc(1, sizeof(*uudecode));
378
	uudecode = calloc(1, sizeof(*uudecode));
377
	out_buff = malloc(OUT_BUFF_SIZE);
379
	out_buff = malloc(OUT_BUFF_SIZE);
378
	in_buff = malloc(IN_BUFF_SIZE);
380
	in_buff = malloc(IN_BUFF_SIZE);
379
	if (uudecode == NULL || out_buff == NULL || in_buff == NULL) {
381
	if (uudecode == NULL || out_buff == NULL || in_buff == NULL) {
Lines 484-489 uudecode_filter_read(struct archive_read_filter *self, const void **buff) Link Here
484
		goto finish;
486
		goto finish;
485
	}
487
	}
486
	if (uudecode->in_cnt) {
488
	if (uudecode->in_cnt) {
489
		if (uudecode->in_cnt > UUENCODE_MAX_LINE_LENGTH) {
490
			archive_set_error(&self->archive->archive,
491
			    ARCHIVE_ERRNO_FILE_FORMAT,
492
			    "Invalid format data");
493
			return (ARCHIVE_FATAL);
494
		}
487
		/*
495
		/*
488
		 * If there is remaining data which is saved by
496
		 * If there is remaining data which is saved by
489
		 * previous calling, use it first.
497
		 * previous calling, use it first.
Lines 498-504 uudecode_filter_read(struct archive_read_filter *self, const void **buff) Link Here
498
		uudecode->in_cnt = 0;
506
		uudecode->in_cnt = 0;
499
	}
507
	}
500
	for (;used < avail_in; d += llen, used += llen) {
508
	for (;used < avail_in; d += llen, used += llen) {
501
		int64_t l, body;
509
		ssize_t l, body;
502
510
503
		b = d;
511
		b = d;
504
		len = get_line(b, avail_in - used, &nl);
512
		len = get_line(b, avail_in - used, &nl);
Lines 533-539 uudecode_filter_read(struct archive_read_filter *self, const void **buff) Link Here
533
				return (ARCHIVE_FATAL);
541
				return (ARCHIVE_FATAL);
534
			if (uudecode->in_buff != b)
542
			if (uudecode->in_buff != b)
535
				memmove(uudecode->in_buff, b, len);
543
				memmove(uudecode->in_buff, b, len);
536
			uudecode->in_cnt = (int)len;
544
			uudecode->in_cnt = len;
537
			if (total == 0) {
545
			if (total == 0) {
538
				/* Do not return 0; it means end-of-file.
546
				/* Do not return 0; it means end-of-file.
539
				 * We should try to read bytes more. */
547
				 * We should try to read bytes more. */
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_xz.c (-2 / +2 lines)
Lines 476-483 xz_lzma_bidder_init(struct archive_read_filter *self) Link Here
476
	struct private_data *state;
476
	struct private_data *state;
477
	int ret;
477
	int ret;
478
478
479
	state = (struct private_data *)calloc(1, sizeof(*state));
479
	state = calloc(1, sizeof(*state));
480
	out_block = (unsigned char *)malloc(out_block_size);
480
	out_block = malloc(out_block_size);
481
	if (state == NULL || out_block == NULL) {
481
	if (state == NULL || out_block == NULL) {
482
		archive_set_error(&self->archive->archive, ENOMEM,
482
		archive_set_error(&self->archive->archive, ENOMEM,
483
		    "Can't allocate data for xz decompression");
483
		    "Can't allocate data for xz decompression");
(-)b/contrib/libarchive/libarchive/archive_read_support_filter_zstd.c (-2 / +2 lines)
Lines 175-182 zstd_bidder_init(struct archive_read_filter *self) Link Here
175
	self->code = ARCHIVE_FILTER_ZSTD;
175
	self->code = ARCHIVE_FILTER_ZSTD;
176
	self->name = "zstd";
176
	self->name = "zstd";
177
177
178
	state = (struct private_data *)calloc(1, sizeof(*state));
178
	state = calloc(1, sizeof(*state));
179
	out_block = (unsigned char *)malloc(out_block_size);
179
	out_block = malloc(out_block_size);
180
	dstream = ZSTD_createDStream();
180
	dstream = ZSTD_createDStream();
181
181
182
	if (state == NULL || out_block == NULL || dstream == NULL) {
182
	if (state == NULL || out_block == NULL || dstream == NULL) {
(-)b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c (-33 / +60 lines)
Lines 767-795 archive_read_format_7zip_read_header(struct archive_read *a, Link Here
767
767
768
	if (zip_entry->attr & supported_attrs) {
768
	if (zip_entry->attr & supported_attrs) {
769
		char *fflags_text, *ptr;
769
		char *fflags_text, *ptr;
770
		/* allocate for "rdonly,hidden,system," */
770
		/* allocate for ",rdonly,hidden,system" */
771
		fflags_text = malloc(22 * sizeof(char));
771
		fflags_text = malloc(22 * sizeof(*fflags_text));
772
		if (fflags_text != NULL) {
772
		if (fflags_text != NULL) {
773
			ptr = fflags_text; 
773
			ptr = fflags_text; 
774
			if (zip_entry->attr & FILE_ATTRIBUTE_READONLY) { 
774
			if (zip_entry->attr & FILE_ATTRIBUTE_READONLY) {
775
 			strcpy(ptr, "rdonly,"); 
775
				strcpy(ptr, ",rdonly");
776
 			ptr = ptr + 7; 
776
				ptr = ptr + 7;
777
 		} 
777
			}
778
 		if (zip_entry->attr & FILE_ATTRIBUTE_HIDDEN) { 
778
			if (zip_entry->attr & FILE_ATTRIBUTE_HIDDEN) {
779
 			strcpy(ptr, "hidden,"); 
779
				strcpy(ptr, ",hidden");
780
 			ptr = ptr + 7; 
780
				ptr = ptr + 7;
781
 		} 
781
			}
782
 		if (zip_entry->attr & FILE_ATTRIBUTE_SYSTEM) { 
782
			if (zip_entry->attr & FILE_ATTRIBUTE_SYSTEM) {
783
 			strcpy(ptr, "system,"); 
783
				strcpy(ptr, ",system");
784
 			ptr = ptr + 7; 
784
				ptr = ptr + 7;
785
 		} 
785
			}
786
 		if (ptr > fflags_text) { 
786
			if (ptr > fflags_text) {
787
 			/* Delete trailing comma */ 
787
				archive_entry_copy_fflags_text(entry,
788
 			*(ptr - 1) = '\0'; 
788
				    fflags_text + 1);
789
 			archive_entry_copy_fflags_text(entry, 
789
			}
790
				fflags_text); 
790
			free(fflags_text);
791
 		} 
792
 		free(fflags_text); 
793
		}
791
		}
794
	}
792
	}
795
793
Lines 835-843 archive_read_format_7zip_read_header(struct archive_read *a, Link Here
835
			zip_entry->mode |= AE_IFREG;
833
			zip_entry->mode |= AE_IFREG;
836
			archive_entry_set_mode(entry, zip_entry->mode);
834
			archive_entry_set_mode(entry, zip_entry->mode);
837
		} else {
835
		} else {
836
			struct archive_string_conv* utf8_conv;
837
838
			symname[symsize] = '\0';
838
			symname[symsize] = '\0';
839
			archive_entry_copy_symlink(entry,
839
840
			    (const char *)symname);
840
			/* Symbolic links are embedded as UTF-8 strings */
841
			utf8_conv = archive_string_conversion_from_charset(&a->archive,
842
			    "UTF-8", 1);
843
			if (utf8_conv == NULL) {
844
				free(symname);
845
				return ARCHIVE_FATAL;
846
			}
847
848
			archive_entry_copy_symlink_l(entry, (const char*)symname, symsize,
849
			    utf8_conv);
841
		}
850
		}
842
		free(symname);
851
		free(symname);
843
		archive_entry_set_size(entry, 0);
852
		archive_entry_set_size(entry, 0);
Lines 877-886 archive_read_format_7zip_read_data(struct archive_read *a, Link Here
877
	if (zip->end_of_entry)
886
	if (zip->end_of_entry)
878
		return (ARCHIVE_EOF);
887
		return (ARCHIVE_EOF);
879
888
880
	const uint64_t max_read_size = 16 * 1024 * 1024;  // Don't try to read more than 16 MB at a time
889
	size_t bytes_to_read = 16 * 1024 * 1024;  // Don't try to read more than 16 MB at a time
881
	size_t bytes_to_read = max_read_size;
882
	if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) {
890
	if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) {
883
		bytes_to_read = zip->entry_bytes_remaining;
891
		bytes_to_read = (size_t)zip->entry_bytes_remaining;
884
	}
892
	}
885
	bytes = read_stream(a, buff, bytes_to_read, 0);
893
	bytes = read_stream(a, buff, bytes_to_read, 0);
886
	if (bytes < 0)
894
	if (bytes < 0)
Lines 1063-1070 ppmd_read(void *p) Link Here
1063
		 */
1071
		 */
1064
		ssize_t bytes_avail = 0;
1072
		ssize_t bytes_avail = 0;
1065
		const uint8_t* data = __archive_read_ahead(a,
1073
		const uint8_t* data = __archive_read_ahead(a,
1066
		    zip->ppstream.stream_in+1, &bytes_avail);
1074
		    (size_t)zip->ppstream.stream_in+1, &bytes_avail);
1067
		if(bytes_avail < zip->ppstream.stream_in+1) {
1075
		if(data == NULL || bytes_avail < zip->ppstream.stream_in+1) {
1068
			archive_set_error(&a->archive,
1076
			archive_set_error(&a->archive,
1069
			    ARCHIVE_ERRNO_FILE_FORMAT,
1077
			    ARCHIVE_ERRNO_FILE_FORMAT,
1070
			    "Truncated 7z file data");
1078
			    "Truncated 7z file data");
Lines 1766-1771 free_decompression(struct archive_read *a, struct _7zip *zip) Link Here
1766
		}
1774
		}
1767
		zip->stream_valid = 0;
1775
		zip->stream_valid = 0;
1768
	}
1776
	}
1777
#endif
1778
#ifdef HAVE_ZSTD_H
1779
	if (zip->zstdstream_valid)
1780
		ZSTD_freeDStream(zip->zstd_dstream);
1769
#endif
1781
#endif
1770
	if (zip->ppmd7_valid) {
1782
	if (zip->ppmd7_valid) {
1771
		__archive_ppmd7_functions.Ppmd7_Free(
1783
		__archive_ppmd7_functions.Ppmd7_Free(
Lines 2308-2314 read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss, Link Here
2308
	usizes = ss->unpackSizes;
2320
	usizes = ss->unpackSizes;
2309
	for (i = 0; i < numFolders; i++) {
2321
	for (i = 0; i < numFolders; i++) {
2310
		unsigned pack;
2322
		unsigned pack;
2311
		uint64_t sum;
2323
		uint64_t size, sum;
2312
2324
2313
		if (f[i].numUnpackStreams == 0)
2325
		if (f[i].numUnpackStreams == 0)
2314
			continue;
2326
			continue;
Lines 2318-2327 read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss, Link Here
2318
			for (pack = 1; pack < f[i].numUnpackStreams; pack++) {
2330
			for (pack = 1; pack < f[i].numUnpackStreams; pack++) {
2319
				if (parse_7zip_uint64(a, usizes) < 0)
2331
				if (parse_7zip_uint64(a, usizes) < 0)
2320
					return (-1);
2332
					return (-1);
2333
				if (*usizes > UINT64_MAX - sum)
2334
					return (-1);
2321
				sum += *usizes++;
2335
				sum += *usizes++;
2322
			}
2336
			}
2323
		}
2337
		}
2324
		*usizes++ = folder_uncompressed_size(&f[i]) - sum;
2338
		size = folder_uncompressed_size(&f[i]);
2339
		if (size < sum)
2340
			return (-1);
2341
		*usizes++ = size - sum;
2325
	}
2342
	}
2326
2343
2327
	if (type == kSize) {
2344
	if (type == kSize) {
Lines 2415-2420 read_StreamsInfo(struct archive_read *a, struct _7z_stream_info *si) Link Here
2415
		packPos = si->pi.pos;
2432
		packPos = si->pi.pos;
2416
		for (i = 0; i < si->pi.numPackStreams; i++) {
2433
		for (i = 0; i < si->pi.numPackStreams; i++) {
2417
			si->pi.positions[i] = packPos;
2434
			si->pi.positions[i] = packPos;
2435
			if (packPos > UINT64_MAX - si->pi.sizes[i])
2436
				return (-1);
2418
			packPos += si->pi.sizes[i];
2437
			packPos += si->pi.sizes[i];
2419
			if (packPos > zip->header_offset)
2438
			if (packPos > zip->header_offset)
2420
				return (-1);
2439
				return (-1);
Lines 2436-2441 read_StreamsInfo(struct archive_read *a, struct _7z_stream_info *si) Link Here
2436
		f = si->ci.folders;
2455
		f = si->ci.folders;
2437
		for (i = 0; i < si->ci.numFolders; i++) {
2456
		for (i = 0; i < si->ci.numFolders; i++) {
2438
			f[i].packIndex = packIndex;
2457
			f[i].packIndex = packIndex;
2458
			if (f[i].numPackedStreams > UINT32_MAX)
2459
				return (-1);
2460
			if (packIndex > UINT32_MAX - (uint32_t)f[i].numPackedStreams)
2461
				return (-1);
2439
			packIndex += (uint32_t)f[i].numPackedStreams;
2462
			packIndex += (uint32_t)f[i].numPackedStreams;
2440
			if (packIndex > si->pi.numPackStreams)
2463
			if (packIndex > si->pi.numPackStreams)
2441
				return (-1);
2464
				return (-1);
Lines 3000-3006 slurp_central_directory(struct archive_read *a, struct _7zip *zip, Link Here
3000
	/* CRC check. */
3023
	/* CRC check. */
3001
	if (crc32(0, (const unsigned char *)p + 12, 20)
3024
	if (crc32(0, (const unsigned char *)p + 12, 20)
3002
	    != archive_le32dec(p + 8)) {
3025
	    != archive_le32dec(p + 8)) {
3003
#ifdef DONT_FAIL_ON_CRC_ERROR
3026
#ifndef DONT_FAIL_ON_CRC_ERROR
3004
		archive_set_error(&a->archive, -1, "Header CRC error");
3027
		archive_set_error(&a->archive, -1, "Header CRC error");
3005
		return (ARCHIVE_FATAL);
3028
		return (ARCHIVE_FATAL);
3006
#endif
3029
#endif
Lines 3142-3148 get_uncompressed_data(struct archive_read *a, const void **buff, size_t size, Link Here
3142
		/* Copy mode. */
3165
		/* Copy mode. */
3143
3166
3144
		*buff = __archive_read_ahead(a, minimum, &bytes_avail);
3167
		*buff = __archive_read_ahead(a, minimum, &bytes_avail);
3145
		if (bytes_avail <= 0) {
3168
		if (*buff == NULL) {
3146
			archive_set_error(&a->archive,
3169
			archive_set_error(&a->archive,
3147
			    ARCHIVE_ERRNO_FILE_FORMAT,
3170
			    ARCHIVE_ERRNO_FILE_FORMAT,
3148
			    "Truncated 7-Zip file data");
3171
			    "Truncated 7-Zip file data");
Lines 3448-3454 read_stream(struct archive_read *a, const void **buff, size_t size, Link Here
3448
	/*
3471
	/*
3449
	 * Skip the bytes we already has skipped in skip_stream().
3472
	 * Skip the bytes we already has skipped in skip_stream().
3450
	 */
3473
	 */
3451
	while (skip_bytes) {
3474
	while (1) {
3452
		ssize_t skipped;
3475
		ssize_t skipped;
3453
3476
3454
		if (zip->uncompressed_buffer_bytes_remaining == 0) {
3477
		if (zip->uncompressed_buffer_bytes_remaining == 0) {
Lines 3468-3473 read_stream(struct archive_read *a, const void **buff, size_t size, Link Here
3468
				return (ARCHIVE_FATAL);
3491
				return (ARCHIVE_FATAL);
3469
			}
3492
			}
3470
		}
3493
		}
3494
3495
		if (!skip_bytes)
3496
			break;
3497
3471
		skipped = get_uncompressed_data(
3498
		skipped = get_uncompressed_data(
3472
			a, buff, (size_t)skip_bytes, 0);
3499
			a, buff, (size_t)skip_bytes, 0);
3473
		if (skipped < 0)
3500
		if (skipped < 0)
(-)b/contrib/libarchive/libarchive/archive_read_support_format_ar.c (-5 / +5 lines)
Lines 103-109 archive_read_support_format_ar(struct archive *_a) Link Here
103
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
103
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
104
	    ARCHIVE_STATE_NEW, "archive_read_support_format_ar");
104
	    ARCHIVE_STATE_NEW, "archive_read_support_format_ar");
105
105
106
	ar = (struct ar *)calloc(1, sizeof(*ar));
106
	ar = calloc(1, sizeof(*ar));
107
	if (ar == NULL) {
107
	if (ar == NULL) {
108
		archive_set_error(&a->archive, ENOMEM,
108
		archive_set_error(&a->archive, ENOMEM,
109
		    "Can't allocate ar data");
109
		    "Can't allocate ar data");
Lines 368-374 _ar_read_header(struct archive_read *a, struct archive_entry *entry, Link Here
368
			return (ARCHIVE_FATAL);
368
			return (ARCHIVE_FATAL);
369
		}
369
		}
370
		/* Store it in the entry. */
370
		/* Store it in the entry. */
371
		p = (char *)malloc(bsd_name_length + 1);
371
		p = malloc(bsd_name_length + 1);
372
		if (p == NULL) {
372
		if (p == NULL) {
373
			archive_set_error(&a->archive, ENOMEM,
373
			archive_set_error(&a->archive, ENOMEM,
374
			    "Can't allocate fname buffer");
374
			    "Can't allocate fname buffer");
Lines 439-447 archive_read_format_ar_read_header(struct archive_read *a, Link Here
439
	if ((header_data = __archive_read_ahead(a, 60, NULL)) == NULL)
439
	if ((header_data = __archive_read_ahead(a, 60, NULL)) == NULL)
440
		/* Broken header. */
440
		/* Broken header. */
441
		return (ARCHIVE_EOF);
441
		return (ARCHIVE_EOF);
442
	
442
443
	unconsumed = 60;
443
	unconsumed = 60;
444
	
444
445
	ret = _ar_read_header(a, entry, ar, (const char *)header_data, &unconsumed);
445
	ret = _ar_read_header(a, entry, ar, (const char *)header_data, &unconsumed);
446
446
447
	if (unconsumed)
447
	if (unconsumed)
Lines 458-464 ar_parse_common_header(struct ar *ar, struct archive_entry *entry, Link Here
458
	uint64_t n;
458
	uint64_t n;
459
459
460
	/* Copy remaining header */
460
	/* Copy remaining header */
461
	archive_entry_set_filetype(entry, AE_IFREG);
462
	archive_entry_set_mtime(entry,
461
	archive_entry_set_mtime(entry,
463
	    (time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L);
462
	    (time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L);
464
	archive_entry_set_uid(entry,
463
	archive_entry_set_uid(entry,
Lines 467-472 ar_parse_common_header(struct ar *ar, struct archive_entry *entry, Link Here
467
	    (gid_t)ar_atol10(h + AR_gid_offset, AR_gid_size));
466
	    (gid_t)ar_atol10(h + AR_gid_offset, AR_gid_size));
468
	archive_entry_set_mode(entry,
467
	archive_entry_set_mode(entry,
469
	    (mode_t)ar_atol8(h + AR_mode_offset, AR_mode_size));
468
	    (mode_t)ar_atol8(h + AR_mode_offset, AR_mode_size));
469
	archive_entry_set_filetype(entry, AE_IFREG);
470
	n = ar_atol10(h + AR_size_offset, AR_size_size);
470
	n = ar_atol10(h + AR_size_offset, AR_size_size);
471
471
472
	ar->entry_offset = 0;
472
	ar->entry_offset = 0;
(-)b/contrib/libarchive/libarchive/archive_read_support_format_cab.c (-6 / +6 lines)
Lines 356-362 archive_read_support_format_cab(struct archive *_a) Link Here
356
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
356
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
357
	    ARCHIVE_STATE_NEW, "archive_read_support_format_cab");
357
	    ARCHIVE_STATE_NEW, "archive_read_support_format_cab");
358
358
359
	cab = (struct cab *)calloc(1, sizeof(*cab));
359
	cab = calloc(1, sizeof(*cab));
360
	if (cab == NULL) {
360
	if (cab == NULL) {
361
		archive_set_error(&a->archive, ENOMEM,
361
		archive_set_error(&a->archive, ENOMEM,
362
		    "Can't allocate CAB data");
362
		    "Can't allocate CAB data");
Lines 717-723 cab_read_header(struct archive_read *a) Link Here
717
	/*
717
	/*
718
	 * Read CFFOLDER.
718
	 * Read CFFOLDER.
719
	 */
719
	 */
720
	hd->folder_array = (struct cffolder *)calloc(
720
	hd->folder_array = calloc(
721
	    hd->folder_count, sizeof(struct cffolder));
721
	    hd->folder_count, sizeof(struct cffolder));
722
	if (hd->folder_array == NULL)
722
	if (hd->folder_array == NULL)
723
		goto nomem;
723
		goto nomem;
Lines 780-786 cab_read_header(struct archive_read *a) Link Here
780
		cab->cab_offset += skip;
780
		cab->cab_offset += skip;
781
	}
781
	}
782
	/* Allocate memory for CFDATA */
782
	/* Allocate memory for CFDATA */
783
	hd->file_array = (struct cffile *)calloc(
783
	hd->file_array = calloc(
784
	    hd->file_count, sizeof(struct cffile));
784
	    hd->file_count, sizeof(struct cffile));
785
	if (hd->file_array == NULL)
785
	if (hd->file_array == NULL)
786
		goto nomem;
786
		goto nomem;
Lines 1412-1418 cab_read_ahead_cfdata_deflate(struct archive_read *a, ssize_t *avail) Link Here
1412
	if (cab->uncompressed_buffer == NULL) {
1412
	if (cab->uncompressed_buffer == NULL) {
1413
		cab->uncompressed_buffer_size = 0x8000;
1413
		cab->uncompressed_buffer_size = 0x8000;
1414
		cab->uncompressed_buffer
1414
		cab->uncompressed_buffer
1415
		    = (unsigned char *)malloc(cab->uncompressed_buffer_size);
1415
		    = malloc(cab->uncompressed_buffer_size);
1416
		if (cab->uncompressed_buffer == NULL) {
1416
		if (cab->uncompressed_buffer == NULL) {
1417
			archive_set_error(&a->archive, ENOMEM,
1417
			archive_set_error(&a->archive, ENOMEM,
1418
			    "No memory for CAB reader");
1418
			    "No memory for CAB reader");
Lines 1641-1647 cab_read_ahead_cfdata_lzx(struct archive_read *a, ssize_t *avail) Link Here
1641
	if (cab->uncompressed_buffer == NULL) {
1641
	if (cab->uncompressed_buffer == NULL) {
1642
		cab->uncompressed_buffer_size = 0x8000;
1642
		cab->uncompressed_buffer_size = 0x8000;
1643
		cab->uncompressed_buffer
1643
		cab->uncompressed_buffer
1644
		    = (unsigned char *)malloc(cab->uncompressed_buffer_size);
1644
		    = malloc(cab->uncompressed_buffer_size);
1645
		if (cab->uncompressed_buffer == NULL) {
1645
		if (cab->uncompressed_buffer == NULL) {
1646
			archive_set_error(&a->archive, ENOMEM,
1646
			archive_set_error(&a->archive, ENOMEM,
1647
			    "No memory for CAB reader");
1647
			    "No memory for CAB reader");
Lines 1682-1688 cab_read_ahead_cfdata_lzx(struct archive_read *a, ssize_t *avail) Link Here
1682
		    cfdata->uncompressed_size - cab->xstrm.total_out;
1682
		    cfdata->uncompressed_size - cab->xstrm.total_out;
1683
1683
1684
		d = __archive_read_ahead(a, 1, &bytes_avail);
1684
		d = __archive_read_ahead(a, 1, &bytes_avail);
1685
		if (bytes_avail <= 0) {
1685
		if (d == NULL) {
1686
			archive_set_error(&a->archive,
1686
			archive_set_error(&a->archive,
1687
			    ARCHIVE_ERRNO_FILE_FORMAT,
1687
			    ARCHIVE_ERRNO_FILE_FORMAT,
1688
			    "Truncated CAB file data");
1688
			    "Truncated CAB file data");
(-)b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c (-11 / +21 lines)
Lines 228-234 archive_read_support_format_cpio(struct archive *_a) Link Here
228
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
228
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
229
	    ARCHIVE_STATE_NEW, "archive_read_support_format_cpio");
229
	    ARCHIVE_STATE_NEW, "archive_read_support_format_cpio");
230
230
231
	cpio = (struct cpio *)calloc(1, sizeof(*cpio));
231
	cpio = calloc(1, sizeof(*cpio));
232
	if (cpio == NULL) {
232
	if (cpio == NULL) {
233
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
233
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
234
		return (ARCHIVE_FATAL);
234
		return (ARCHIVE_FATAL);
Lines 834-839 static int Link Here
834
header_afiol(struct archive_read *a, struct cpio *cpio,
834
header_afiol(struct archive_read *a, struct cpio *cpio,
835
    struct archive_entry *entry, size_t *namelength, size_t *name_pad)
835
    struct archive_entry *entry, size_t *namelength, size_t *name_pad)
836
{
836
{
837
	int64_t t;
837
	const void *h;
838
	const void *h;
838
	const char *header;
839
	const char *header;
839
840
Lines 850-856 header_afiol(struct archive_read *a, struct cpio *cpio, Link Here
850
851
851
	archive_entry_set_dev(entry, 
852
	archive_entry_set_dev(entry, 
852
		(dev_t)atol16(header + afiol_dev_offset, afiol_dev_size));
853
		(dev_t)atol16(header + afiol_dev_offset, afiol_dev_size));
853
	archive_entry_set_ino(entry, atol16(header + afiol_ino_offset, afiol_ino_size));
854
	t = atol16(header + afiol_ino_offset, afiol_ino_size);
855
	if (t < 0) {
856
		archive_set_error(&a->archive, 0, "Nonsensical ino value");
857
		return (ARCHIVE_FATAL);
858
	}
859
	archive_entry_set_ino(entry, t);
854
	archive_entry_set_mode(entry,
860
	archive_entry_set_mode(entry,
855
		(mode_t)atol8(header + afiol_mode_offset, afiol_mode_size));
861
		(mode_t)atol8(header + afiol_mode_offset, afiol_mode_size));
856
	archive_entry_set_uid(entry, atol16(header + afiol_uid_offset, afiol_uid_size));
862
	archive_entry_set_uid(entry, atol16(header + afiol_uid_offset, afiol_uid_size));
Lines 863-870 header_afiol(struct archive_read *a, struct cpio *cpio, Link Here
863
	*namelength = (size_t)atol16(header + afiol_namesize_offset, afiol_namesize_size);
869
	*namelength = (size_t)atol16(header + afiol_namesize_offset, afiol_namesize_size);
864
	*name_pad = 0; /* No padding of filename. */
870
	*name_pad = 0; /* No padding of filename. */
865
871
866
	cpio->entry_bytes_remaining =
872
	t = atol16(header + afiol_filesize_offset, afiol_filesize_size);
867
	    atol16(header + afiol_filesize_offset, afiol_filesize_size);
873
	if (t < 0) {
874
		archive_set_error(&a->archive, 0, "Nonsensical file size");
875
		return (ARCHIVE_FATAL);
876
	}
877
	cpio->entry_bytes_remaining = t;
868
	archive_entry_set_size(entry, cpio->entry_bytes_remaining);
878
	archive_entry_set_size(entry, cpio->entry_bytes_remaining);
869
	cpio->entry_padding = 0;
879
	cpio->entry_padding = 0;
870
	__archive_read_consume(a, afiol_header_size);
880
	__archive_read_consume(a, afiol_header_size);
Lines 1002-1008 be4(const unsigned char *p) Link Here
1002
static int64_t
1012
static int64_t
1003
atol8(const char *p, unsigned char_cnt)
1013
atol8(const char *p, unsigned char_cnt)
1004
{
1014
{
1005
	int64_t l;
1015
	uint64_t l;
1006
	int digit;
1016
	int digit;
1007
1017
1008
	l = 0;
1018
	l = 0;
Lines 1010-1027 atol8(const char *p, unsigned char_cnt) Link Here
1010
		if (*p >= '0' && *p <= '7')
1020
		if (*p >= '0' && *p <= '7')
1011
			digit = *p - '0';
1021
			digit = *p - '0';
1012
		else
1022
		else
1013
			return (l);
1023
			return ((int64_t)l);
1014
		p++;
1024
		p++;
1015
		l <<= 3;
1025
		l <<= 3;
1016
		l |= digit;
1026
		l |= digit;
1017
	}
1027
	}
1018
	return (l);
1028
	return ((int64_t)l);
1019
}
1029
}
1020
1030
1021
static int64_t
1031
static int64_t
1022
atol16(const char *p, unsigned char_cnt)
1032
atol16(const char *p, unsigned char_cnt)
1023
{
1033
{
1024
	int64_t l;
1034
	uint64_t l;
1025
	int digit;
1035
	int digit;
1026
1036
1027
	l = 0;
1037
	l = 0;
Lines 1033-1044 atol16(const char *p, unsigned char_cnt) Link Here
1033
		else if (*p >= '0' && *p <= '9')
1043
		else if (*p >= '0' && *p <= '9')
1034
			digit = *p - '0';
1044
			digit = *p - '0';
1035
		else
1045
		else
1036
			return (l);
1046
			return ((int64_t)l);
1037
		p++;
1047
		p++;
1038
		l <<= 4;
1048
		l <<= 4;
1039
		l |= digit;
1049
		l |= digit;
1040
	}
1050
	}
1041
	return (l);
1051
	return ((int64_t)l);
1042
}
1052
}
1043
1053
1044
static int
1054
static int
Lines 1078-1084 record_hardlink(struct archive_read *a, Link Here
1078
		}
1088
		}
1079
	}
1089
	}
1080
1090
1081
	le = (struct links_entry *)malloc(sizeof(struct links_entry));
1091
	le = malloc(sizeof(struct links_entry));
1082
	if (le == NULL) {
1092
	if (le == NULL) {
1083
		archive_set_error(&a->archive,
1093
		archive_set_error(&a->archive,
1084
		    ENOMEM, "Out of memory adding file to list");
1094
		    ENOMEM, "Out of memory adding file to list");
(-)b/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c (-27 / +278 lines)
Lines 273-279 struct file_info { Link Here
273
	char		 re;		/* Having RRIP "RE" extension.	*/
273
	char		 re;		/* Having RRIP "RE" extension.	*/
274
	char		 re_descendant;
274
	char		 re_descendant;
275
	uint64_t	 cl_offset;	/* Having RRIP "CL" extension.	*/
275
	uint64_t	 cl_offset;	/* Having RRIP "CL" extension.	*/
276
	int		 birthtime_is_set;
276
	int		 time_is_set;	/* Bitmask indicating which times are known */
277
	time_t		 birthtime;	/* File created time.		*/
277
	time_t		 birthtime;	/* File created time.		*/
278
	time_t		 mtime;		/* File last modified time.	*/
278
	time_t		 mtime;		/* File last modified time.	*/
279
	time_t		 atime;		/* File last accessed time.	*/
279
	time_t		 atime;		/* File last accessed time.	*/
Lines 306-311 struct file_info { Link Here
306
	} rede_files;
306
	} rede_files;
307
};
307
};
308
308
309
#define BIRTHTIME_IS_SET 1
310
#define MTIME_IS_SET 2
311
#define ATIME_IS_SET 4
312
#define CTIME_IS_SET 8
313
309
struct heap_queue {
314
struct heap_queue {
310
	struct file_info **files;
315
	struct file_info **files;
311
	int		 allocated;
316
	int		 allocated;
Lines 394-400 static void dump_isodirrec(FILE *, const unsigned char *isodirrec); Link Here
394
#endif
399
#endif
395
static time_t	time_from_tm(struct tm *);
400
static time_t	time_from_tm(struct tm *);
396
static time_t	isodate17(const unsigned char *);
401
static time_t	isodate17(const unsigned char *);
402
static int	isodate17_valid(const unsigned char *);
397
static time_t	isodate7(const unsigned char *);
403
static time_t	isodate7(const unsigned char *);
404
static int	isodate7_valid(const unsigned char *);
398
static int	isBootRecord(struct iso9660 *, const unsigned char *);
405
static int	isBootRecord(struct iso9660 *, const unsigned char *);
399
static int	isVolumePartition(struct iso9660 *, const unsigned char *);
406
static int	isVolumePartition(struct iso9660 *, const unsigned char *);
400
static int	isVDSetTerminator(struct iso9660 *, const unsigned char *);
407
static int	isVDSetTerminator(struct iso9660 *, const unsigned char *);
Lines 402-407 static int isJolietSVD(struct iso9660 *, const unsigned char *); Link Here
402
static int	isSVD(struct iso9660 *, const unsigned char *);
409
static int	isSVD(struct iso9660 *, const unsigned char *);
403
static int	isEVD(struct iso9660 *, const unsigned char *);
410
static int	isEVD(struct iso9660 *, const unsigned char *);
404
static int	isPVD(struct iso9660 *, const unsigned char *);
411
static int	isPVD(struct iso9660 *, const unsigned char *);
412
static int	isRootDirectoryRecord(const unsigned char *);
413
static int	isValid723Integer(const unsigned char *);
414
static int	isValid733Integer(const unsigned char *);
405
static int	next_cache_entry(struct archive_read *, struct iso9660 *,
415
static int	next_cache_entry(struct archive_read *, struct iso9660 *,
406
		    struct file_info **);
416
		    struct file_info **);
407
static int	next_entry_seek(struct archive_read *, struct iso9660 *,
417
static int	next_entry_seek(struct archive_read *, struct iso9660 *,
Lines 453-459 archive_read_support_format_iso9660(struct archive *_a) Link Here
453
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
463
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
454
	    ARCHIVE_STATE_NEW, "archive_read_support_format_iso9660");
464
	    ARCHIVE_STATE_NEW, "archive_read_support_format_iso9660");
455
465
456
	iso9660 = (struct iso9660 *)calloc(1, sizeof(*iso9660));
466
	iso9660 = calloc(1, sizeof(*iso9660));
457
	if (iso9660 == NULL) {
467
	if (iso9660 == NULL) {
458
		archive_set_error(&a->archive, ENOMEM,
468
		archive_set_error(&a->archive, ENOMEM,
459
		    "Can't allocate iso9660 data");
469
		    "Can't allocate iso9660 data");
Lines 773-780 isSVD(struct iso9660 *iso9660, const unsigned char *h) Link Here
773
783
774
	/* Read Root Directory Record in Volume Descriptor. */
784
	/* Read Root Directory Record in Volume Descriptor. */
775
	p = h + SVD_root_directory_record_offset;
785
	p = h + SVD_root_directory_record_offset;
776
	if (p[DR_length_offset] != 34)
786
	if (!isRootDirectoryRecord(p)) {
777
		return (0);
787
		return (0);
788
	}
778
789
779
	return (48);
790
	return (48);
780
}
791
}
Lines 851-858 isEVD(struct iso9660 *iso9660, const unsigned char *h) Link Here
851
862
852
	/* Read Root Directory Record in Volume Descriptor. */
863
	/* Read Root Directory Record in Volume Descriptor. */
853
	p = h + PVD_root_directory_record_offset;
864
	p = h + PVD_root_directory_record_offset;
854
	if (p[DR_length_offset] != 34)
865
	if (!isRootDirectoryRecord(p)) {
855
		return (0);
866
		return (0);
867
	}
856
868
857
	return (48);
869
	return (48);
858
}
870
}
Lines 882-902 isPVD(struct iso9660 *iso9660, const unsigned char *h) Link Here
882
	if (!isNull(iso9660, h, PVD_reserved2_offset, PVD_reserved2_size))
894
	if (!isNull(iso9660, h, PVD_reserved2_offset, PVD_reserved2_size))
883
		return (0);
895
		return (0);
884
896
897
	/* Volume space size must be encoded according to 7.3.3 */
898
	if (!isValid733Integer(h + PVD_volume_space_size_offset)) {
899
		return (0);
900
	}
901
	volume_block = archive_le32dec(h + PVD_volume_space_size_offset);
902
	if (volume_block <= SYSTEM_AREA_BLOCK+4)
903
		return (0);
904
885
	/* Reserved field must be 0. */
905
	/* Reserved field must be 0. */
886
	if (!isNull(iso9660, h, PVD_reserved3_offset, PVD_reserved3_size))
906
	if (!isNull(iso9660, h, PVD_reserved3_offset, PVD_reserved3_size))
887
		return (0);
907
		return (0);
888
908
909
	/* Volume set size must be encoded according to 7.2.3 */
910
	if (!isValid723Integer(h + PVD_volume_set_size_offset)) {
911
		return (0);
912
	}
913
914
	/* Volume sequence number must be encoded according to 7.2.3 */
915
	if (!isValid723Integer(h + PVD_volume_sequence_number_offset)) {
916
		return (0);
917
	}
918
889
	/* Logical block size must be > 0. */
919
	/* Logical block size must be > 0. */
890
	/* I've looked at Ecma 119 and can't find any stronger
920
	/* I've looked at Ecma 119 and can't find any stronger
891
	 * restriction on this field. */
921
	 * restriction on this field. */
922
	if (!isValid723Integer(h + PVD_logical_block_size_offset)) {
923
		return (0);
924
	}
892
	logical_block_size =
925
	logical_block_size =
893
	    archive_le16dec(h + PVD_logical_block_size_offset);
926
	    archive_le16dec(h + PVD_logical_block_size_offset);
894
	if (logical_block_size <= 0)
927
	if (logical_block_size <= 0)
895
		return (0);
928
		return (0);
896
929
897
	volume_block = archive_le32dec(h + PVD_volume_space_size_offset);
930
	/* Path Table size must be encoded according to 7.3.3 */
898
	if (volume_block <= SYSTEM_AREA_BLOCK+4)
931
	if (!isValid733Integer(h + PVD_path_table_size_offset)) {
899
		return (0);
932
		return (0);
933
	}
900
934
901
	/* File structure version must be 1 for ISO9660/ECMA119. */
935
	/* File structure version must be 1 for ISO9660/ECMA119. */
902
	if (h[PVD_file_structure_version_offset] != 1)
936
	if (h[PVD_file_structure_version_offset] != 1)
Lines 935-942 isPVD(struct iso9660 *iso9660, const unsigned char *h) Link Here
935
969
936
	/* Read Root Directory Record in Volume Descriptor. */
970
	/* Read Root Directory Record in Volume Descriptor. */
937
	p = h + PVD_root_directory_record_offset;
971
	p = h + PVD_root_directory_record_offset;
938
	if (p[DR_length_offset] != 34)
972
	if (!isRootDirectoryRecord(p)) {
939
		return (0);
973
		return (0);
974
	}
940
975
941
	if (!iso9660->primary.location) {
976
	if (!iso9660->primary.location) {
942
		iso9660->logical_block_size = logical_block_size;
977
		iso9660->logical_block_size = logical_block_size;
Lines 951-956 isPVD(struct iso9660 *iso9660, const unsigned char *h) Link Here
951
	return (48);
986
	return (48);
952
}
987
}
953
988
989
static int
990
isRootDirectoryRecord(const unsigned char *p) {
991
	int flags;
992
993
	/* ECMA119/ISO9660 requires that the root directory record be _exactly_ 34 bytes.
994
	 * However, we've seen images that have root directory records up to 68 bytes. */
995
	if (p[DR_length_offset] < 34 || p[DR_length_offset] > 68) {
996
		return (0);
997
	}
998
999
	/* The root directory location must be a 7.3.3 32-bit integer. */
1000
	if (!isValid733Integer(p + DR_extent_offset)) {
1001
		return (0);
1002
	}
1003
1004
	/* The root directory size must be a 7.3.3 integer. */
1005
	if (!isValid733Integer(p + DR_size_offset)) {
1006
		return (0);
1007
	}
1008
1009
	/* According to the standard, certain bits must be one or zero:
1010
	 * Bit 1: must be 1 (this is a directory)
1011
	 * Bit 2: must be 0 (not an associated file)
1012
	 * Bit 3: must be 0 (doesn't use extended attribute record)
1013
	 * Bit 7: must be 0 (final directory record for this file)
1014
	 */
1015
	flags = p[DR_flags_offset];
1016
	if ((flags & 0x8E) != 0x02) {
1017
		return (0);
1018
	}
1019
1020
	/* Volume sequence number must be a 7.2.3 integer. */
1021
	if (!isValid723Integer(p + DR_volume_sequence_number_offset)) {
1022
		return (0);
1023
	}
1024
1025
	/* Root directory name is a single zero byte... */
1026
	if (p[DR_name_len_offset] != 1 || p[DR_name_offset] != 0) {
1027
		return (0);
1028
	}
1029
1030
	/* Nothing looked wrong, so let's accept it. */
1031
	return (1);
1032
}
1033
954
static int
1034
static int
955
read_children(struct archive_read *a, struct file_info *parent)
1035
read_children(struct archive_read *a, struct file_info *parent)
956
{
1036
{
Lines 1212-1218 archive_read_format_iso9660_read_header(struct archive_read *a, Link Here
1212
			}
1292
			}
1213
		}
1293
		}
1214
		if (iso9660->utf16be_previous_path == NULL) {
1294
		if (iso9660->utf16be_previous_path == NULL) {
1215
			iso9660->utf16be_previous_path = malloc(UTF16_NAME_MAX);
1295
			iso9660->utf16be_previous_path = calloc(1, UTF16_NAME_MAX);
1216
			if (iso9660->utf16be_previous_path == NULL) {
1296
			if (iso9660->utf16be_previous_path == NULL) {
1217
				archive_set_error(&a->archive, ENOMEM,
1297
				archive_set_error(&a->archive, ENOMEM,
1218
				    "No memory");
1298
				    "No memory");
Lines 1278-1290 archive_read_format_iso9660_read_header(struct archive_read *a, Link Here
1278
	archive_entry_set_uid(entry, file->uid);
1358
	archive_entry_set_uid(entry, file->uid);
1279
	archive_entry_set_gid(entry, file->gid);
1359
	archive_entry_set_gid(entry, file->gid);
1280
	archive_entry_set_nlink(entry, file->nlinks);
1360
	archive_entry_set_nlink(entry, file->nlinks);
1281
	if (file->birthtime_is_set)
1361
	if ((file->time_is_set & BIRTHTIME_IS_SET))
1282
		archive_entry_set_birthtime(entry, file->birthtime, 0);
1362
		archive_entry_set_birthtime(entry, file->birthtime, 0);
1283
	else
1363
	else
1284
		archive_entry_unset_birthtime(entry);
1364
		archive_entry_unset_birthtime(entry);
1285
	archive_entry_set_mtime(entry, file->mtime, 0);
1365
	if ((file->time_is_set & MTIME_IS_SET))
1286
	archive_entry_set_ctime(entry, file->ctime, 0);
1366
		archive_entry_set_mtime(entry, file->mtime, 0);
1287
	archive_entry_set_atime(entry, file->atime, 0);
1367
	else
1368
		archive_entry_unset_mtime(entry);
1369
	if ((file->time_is_set & CTIME_IS_SET))
1370
		archive_entry_set_ctime(entry, file->ctime, 0);
1371
	else
1372
		archive_entry_unset_ctime(entry);
1373
	if ((file->time_is_set & ATIME_IS_SET))
1374
		archive_entry_set_atime(entry, file->atime, 0);
1375
	else
1376
		archive_entry_unset_atime(entry);
1288
	/* N.B.: Rock Ridge supports 64-bit device numbers. */
1377
	/* N.B.: Rock Ridge supports 64-bit device numbers. */
1289
	archive_entry_set_rdev(entry, (dev_t)file->rdev);
1378
	archive_entry_set_rdev(entry, (dev_t)file->rdev);
1290
	archive_entry_set_size(entry, iso9660->entry_bytes_remaining);
1379
	archive_entry_set_size(entry, iso9660->entry_bytes_remaining);
Lines 1816-1822 parse_file_info(struct archive_read *a, struct file_info *parent, Link Here
1816
	}
1905
	}
1817
1906
1818
	/* Create a new file entry and copy data from the ISO dir record. */
1907
	/* Create a new file entry and copy data from the ISO dir record. */
1819
	file = (struct file_info *)calloc(1, sizeof(*file));
1908
	file = calloc(1, sizeof(*file));
1820
	if (file == NULL) {
1909
	if (file == NULL) {
1821
		archive_set_error(&a->archive, ENOMEM,
1910
		archive_set_error(&a->archive, ENOMEM,
1822
		    "No memory for file entry");
1911
		    "No memory for file entry");
Lines 1825-1832 parse_file_info(struct archive_read *a, struct file_info *parent, Link Here
1825
	file->parent = parent;
1914
	file->parent = parent;
1826
	file->offset = offset;
1915
	file->offset = offset;
1827
	file->size = fsize;
1916
	file->size = fsize;
1828
	file->mtime = isodate7(isodirrec + DR_date_offset);
1917
	if (isodate7_valid(isodirrec + DR_date_offset)) {
1829
	file->ctime = file->atime = file->mtime;
1918
		file->time_is_set |= MTIME_IS_SET | ATIME_IS_SET | CTIME_IS_SET;
1919
		file->mtime = isodate7(isodirrec + DR_date_offset);
1920
		file->ctime = file->atime = file->mtime;
1921
	}
1830
	file->rede_files.first = NULL;
1922
	file->rede_files.first = NULL;
1831
	file->rede_files.last = &(file->rede_files.first);
1923
	file->rede_files.last = &(file->rede_files.first);
1832
1924
Lines 2500-2550 parse_rockridge_TF1(struct file_info *file, const unsigned char *data, Link Here
2500
		/* Use 17-byte time format. */
2592
		/* Use 17-byte time format. */
2501
		if ((flag & 1) && data_length >= 17) {
2593
		if ((flag & 1) && data_length >= 17) {
2502
			/* Create time. */
2594
			/* Create time. */
2503
			file->birthtime_is_set = 1;
2595
			if (isodate17_valid(data)) {
2504
			file->birthtime = isodate17(data);
2596
				file->time_is_set |= BIRTHTIME_IS_SET;
2597
				file->birthtime = isodate17(data);
2598
			}
2505
			data += 17;
2599
			data += 17;
2506
			data_length -= 17;
2600
			data_length -= 17;
2507
		}
2601
		}
2508
		if ((flag & 2) && data_length >= 17) {
2602
		if ((flag & 2) && data_length >= 17) {
2509
			/* Modify time. */
2603
			/* Modify time. */
2510
			file->mtime = isodate17(data);
2604
			if (isodate17_valid(data)) {
2605
				file->time_is_set |= MTIME_IS_SET;
2606
				file->mtime = isodate17(data);
2607
			}
2511
			data += 17;
2608
			data += 17;
2512
			data_length -= 17;
2609
			data_length -= 17;
2513
		}
2610
		}
2514
		if ((flag & 4) && data_length >= 17) {
2611
		if ((flag & 4) && data_length >= 17) {
2515
			/* Access time. */
2612
			/* Access time. */
2516
			file->atime = isodate17(data);
2613
			if (isodate17_valid(data)) {
2614
				file->time_is_set |= ATIME_IS_SET;
2615
				file->atime = isodate17(data);
2616
			}
2517
			data += 17;
2617
			data += 17;
2518
			data_length -= 17;
2618
			data_length -= 17;
2519
		}
2619
		}
2520
		if ((flag & 8) && data_length >= 17) {
2620
		if ((flag & 8) && data_length >= 17) {
2521
			/* Attribute change time. */
2621
			/* Attribute change time. */
2522
			file->ctime = isodate17(data);
2622
			if (isodate17_valid(data)) {
2623
				file->time_is_set |= CTIME_IS_SET;
2624
				file->ctime = isodate17(data);
2625
			}
2523
		}
2626
		}
2524
	} else {
2627
	} else {
2525
		/* Use 7-byte time format. */
2628
		/* Use 7-byte time format. */
2526
		if ((flag & 1) && data_length >= 7) {
2629
		if ((flag & 1) && data_length >= 7) {
2527
			/* Create time. */
2630
			/* Create time. */
2528
			file->birthtime_is_set = 1;
2631
			if (isodate7_valid(data)) {
2529
			file->birthtime = isodate7(data);
2632
				file->time_is_set |= BIRTHTIME_IS_SET;
2633
				file->birthtime = isodate7(data);
2634
			}
2530
			data += 7;
2635
			data += 7;
2531
			data_length -= 7;
2636
			data_length -= 7;
2532
		}
2637
		}
2533
		if ((flag & 2) && data_length >= 7) {
2638
		if ((flag & 2) && data_length >= 7) {
2534
			/* Modify time. */
2639
			/* Modify time. */
2535
			file->mtime = isodate7(data);
2640
			if (isodate7_valid(data)) {
2641
				file->time_is_set |= MTIME_IS_SET;
2642
				file->mtime = isodate7(data);
2643
			}
2536
			data += 7;
2644
			data += 7;
2537
			data_length -= 7;
2645
			data_length -= 7;
2538
		}
2646
		}
2539
		if ((flag & 4) && data_length >= 7) {
2647
		if ((flag & 4) && data_length >= 7) {
2540
			/* Access time. */
2648
			/* Access time. */
2541
			file->atime = isodate7(data);
2649
			if (isodate7_valid(data)) {
2650
				file->time_is_set |= ATIME_IS_SET;
2651
				file->atime = isodate7(data);
2652
			}
2542
			data += 7;
2653
			data += 7;
2543
			data_length -= 7;
2654
			data_length -= 7;
2544
		}
2655
		}
2545
		if ((flag & 8) && data_length >= 7) {
2656
		if ((flag & 8) && data_length >= 7) {
2546
			/* Attribute change time. */
2657
			/* Attribute change time. */
2547
			file->ctime = isodate7(data);
2658
			if (isodate7_valid(data)) {
2659
				file->time_is_set |= CTIME_IS_SET;
2660
				file->ctime = isodate7(data);
2661
			}
2548
		}
2662
		}
2549
	}
2663
	}
2550
}
2664
}
Lines 3033-3039 heap_add_entry(struct archive_read *a, struct heap_queue *heap, Link Here
3033
			return (ARCHIVE_FATAL);
3147
			return (ARCHIVE_FATAL);
3034
		}
3148
		}
3035
		new_pending_files = (struct file_info **)
3149
		new_pending_files = (struct file_info **)
3036
		    malloc(new_size * sizeof(new_pending_files[0]));
3150
		    calloc(new_size, sizeof(new_pending_files[0]));
3037
		if (new_pending_files == NULL) {
3151
		if (new_pending_files == NULL) {
3038
			archive_set_error(&a->archive,
3152
			archive_set_error(&a->archive,
3039
			    ENOMEM, "Out of memory");
3153
			    ENOMEM, "Out of memory");
Lines 3127-3132 toi(const void *p, int n) Link Here
3127
	return (0);
3241
	return (0);
3128
}
3242
}
3129
3243
3244
/*
3245
 * ECMA119/ISO9660 stores multi-byte integers in one of
3246
 * three different formats:
3247
 *  * Little-endian (specified in section 7.2.1 and 7.3.1)
3248
 *  * Big-endian (specified in section 7.2.2 and 7.3.2)
3249
 *  * Both (specified in section 7.2.3 and 7.3.3)
3250
 *
3251
 * For values that follow section 7.2.3 (16-bit) or 7.3.3 (32-bit), we
3252
 * can check that the little-endian and big-endian forms agree with
3253
 * each other.  This helps us avoid trying to decode files that are
3254
 * not really ISO images.
3255
 */
3256
static int
3257
isValid723Integer(const unsigned char *p) {
3258
	return (p[0] == p[3] && p[1] == p[2]);
3259
}
3260
3261
static int
3262
isValid733Integer(const unsigned char *p)
3263
{
3264
	return (p[0] == p[7]
3265
		&& p[1] == p[6]
3266
		&& p[2] == p[5]
3267
		&& p[3] == p[4]);
3268
}
3269
3270
static int
3271
isodate7_valid(const unsigned char *v)
3272
{
3273
	int year = v[0];
3274
	int month = v[1];
3275
	int day = v[2];
3276
	int hour = v[3];
3277
	int minute = v[4];
3278
	int second = v[5];
3279
	int gmt_off = (signed char)v[6];
3280
3281
	/* ECMA-119 9.1.5 "If all seven values are zero, it shall mean
3282
	 * that the date is unspecified" */
3283
	if (year == 0
3284
	    && month == 0
3285
	    && day == 0
3286
	    && hour == 0
3287
	    && minute == 0
3288
	    && second == 0
3289
	    && gmt_off == 0)
3290
		return 0;
3291
	/*
3292
	 * Sanity-test each individual field
3293
	 */
3294
	/* Year can have any value */
3295
	/* Month must be 1-12 */
3296
	if (month < 1 || month > 12)
3297
		return 0;
3298
	/* Day must be 1-31 */
3299
	if (day < 1 || day > 31)
3300
		return 0;
3301
	/* Hour must be 0-23 */
3302
	if (hour > 23)
3303
		return 0;
3304
	/* Minute must be 0-59 */
3305
	if (minute > 59)
3306
		return 0;
3307
	/* second must be 0-59 according to ECMA-119 9.1.5 */
3308
	/* BUT: we should probably allow for the time being in UTC, which
3309
	   allows up to 61 seconds in a minute in certain cases */
3310
	if (second > 61)
3311
		return 0;
3312
	/* Offset from GMT must be -48 to +52 */
3313
	if (gmt_off < -48 || gmt_off > +52)
3314
		return 0;
3315
3316
	/* All tests pass, this is OK */
3317
	return 1;
3318
}
3319
3130
static time_t
3320
static time_t
3131
isodate7(const unsigned char *v)
3321
isodate7(const unsigned char *v)
3132
{
3322
{
Lines 3153-3158 isodate7(const unsigned char *v) Link Here
3153
	return (t);
3343
	return (t);
3154
}
3344
}
3155
3345
3346
static int
3347
isodate17_valid(const unsigned char *v)
3348
{
3349
	/* First 16 bytes are all ASCII digits */
3350
	for (int i = 0; i < 16; i++) {
3351
		if (v[i] < '0' || v[i] > '9')
3352
			return 0;
3353
	}
3354
3355
	int year = (v[0] - '0') * 1000 + (v[1] - '0') * 100
3356
		+ (v[2] - '0') * 10 + (v[3] - '0');
3357
	int month = (v[4] - '0') * 10 + (v[5] - '0');
3358
	int day = (v[6] - '0') * 10 + (v[7] - '0');
3359
	int hour = (v[8] - '0') * 10 + (v[9] - '0');
3360
	int minute = (v[10] - '0') * 10 + (v[11] - '0');
3361
	int second = (v[12] - '0') * 10 + (v[13] - '0');
3362
	int hundredths = (v[14] - '0') * 10 + (v[15] - '0');
3363
	int gmt_off = (signed char)v[16];
3364
3365
	if (year == 0 && month == 0 && day == 0
3366
	    && hour == 0 && minute == 0 && second == 0
3367
	    && hundredths == 0 && gmt_off == 0)
3368
		return 0;
3369
	/*
3370
	 * Sanity-test each individual field
3371
	 */
3372
3373
	/* Year must be 1900-2300 */
3374
	/* (Not specified in ECMA-119, but these seem
3375
	   like reasonable limits. */
3376
	if (year < 1900 || year > 2300)
3377
		return 0;
3378
	/* Month must be 1-12 */
3379
	if (month < 1 || month > 12)
3380
		return 0;
3381
	/* Day must be 1-31 */
3382
	if (day < 1 || day > 31)
3383
		return 0;
3384
	/* Hour must be 0-23 */
3385
	if (hour > 23)
3386
		return 0;
3387
	/* Minute must be 0-59 */
3388
	if (minute > 59)
3389
		return 0;
3390
	/* second must be 0-59 according to ECMA-119 9.1.5 */
3391
	/* BUT: we should probably allow for the time being in UTC, which
3392
	   allows up to 61 seconds in a minute in certain cases */
3393
	if (second > 61)
3394
		return 0;
3395
	/* Hundredths must be 0-99 */
3396
	if (hundredths > 99)
3397
		return 0;
3398
	/* Offset from GMT must be -48 to +52 */
3399
	if (gmt_off < -48 || gmt_off > +52)
3400
		return 0;
3401
3402
	/* All tests pass, this is OK */
3403
	return 1;
3404
3405
}
3406
3156
static time_t
3407
static time_t
3157
isodate17(const unsigned char *v)
3408
isodate17(const unsigned char *v)
3158
{
3409
{
Lines 3164-3170 isodate17(const unsigned char *v) Link Here
3164
	tm.tm_year = (v[0] - '0') * 1000 + (v[1] - '0') * 100
3415
	tm.tm_year = (v[0] - '0') * 1000 + (v[1] - '0') * 100
3165
	    + (v[2] - '0') * 10 + (v[3] - '0')
3416
	    + (v[2] - '0') * 10 + (v[3] - '0')
3166
	    - 1900;
3417
	    - 1900;
3167
	tm.tm_mon = (v[4] - '0') * 10 + (v[5] - '0');
3418
	tm.tm_mon = (v[4] - '0') * 10 + (v[5] - '0') - 1;
3168
	tm.tm_mday = (v[6] - '0') * 10 + (v[7] - '0');
3419
	tm.tm_mday = (v[6] - '0') * 10 + (v[7] - '0');
3169
	tm.tm_hour = (v[8] - '0') * 10 + (v[9] - '0');
3420
	tm.tm_hour = (v[8] - '0') * 10 + (v[9] - '0');
3170
	tm.tm_min = (v[10] - '0') * 10 + (v[11] - '0');
3421
	tm.tm_min = (v[10] - '0') * 10 + (v[11] - '0');
(-)b/contrib/libarchive/libarchive/archive_read_support_format_lha.c (-6 / +5 lines)
Lines 227-233 static int lha_read_file_header_1(struct archive_read *, struct lha *); Link Here
227
static int	lha_read_file_header_2(struct archive_read *, struct lha *);
227
static int	lha_read_file_header_2(struct archive_read *, struct lha *);
228
static int	lha_read_file_header_3(struct archive_read *, struct lha *);
228
static int	lha_read_file_header_3(struct archive_read *, struct lha *);
229
static int	lha_read_file_extended_header(struct archive_read *,
229
static int	lha_read_file_extended_header(struct archive_read *,
230
		    struct lha *, uint16_t *, int, size_t, size_t *);
230
		    struct lha *, uint16_t *, int, uint64_t, size_t *);
231
static size_t	lha_check_header_format(const void *);
231
static size_t	lha_check_header_format(const void *);
232
static int	lha_skip_sfx(struct archive_read *);
232
static int	lha_skip_sfx(struct archive_read *);
233
static time_t	lha_dos_time(const unsigned char *);
233
static time_t	lha_dos_time(const unsigned char *);
Lines 265-271 archive_read_support_format_lha(struct archive *_a) Link Here
265
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
265
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
266
	    ARCHIVE_STATE_NEW, "archive_read_support_format_lha");
266
	    ARCHIVE_STATE_NEW, "archive_read_support_format_lha");
267
267
268
	lha = (struct lha *)calloc(1, sizeof(*lha));
268
	lha = calloc(1, sizeof(*lha));
269
	if (lha == NULL) {
269
	if (lha == NULL) {
270
		archive_set_error(&a->archive, ENOMEM,
270
		archive_set_error(&a->archive, ENOMEM,
271
		    "Can't allocate lha data");
271
		    "Can't allocate lha data");
Lines 945-951 lha_read_file_header_1(struct archive_read *a, struct lha *lha) Link Here
945
945
946
	/* Read extended headers */
946
	/* Read extended headers */
947
	err2 = lha_read_file_extended_header(a, lha, NULL, 2,
947
	err2 = lha_read_file_extended_header(a, lha, NULL, 2,
948
	    (size_t)(lha->compsize + 2), &extdsize);
948
	    (uint64_t)(lha->compsize + 2), &extdsize);
949
	if (err2 < ARCHIVE_WARN)
949
	if (err2 < ARCHIVE_WARN)
950
		return (err2);
950
		return (err2);
951
	if (err2 < err)
951
	if (err2 < err)
Lines 1138-1144 lha_read_file_header_3(struct archive_read *a, struct lha *lha) Link Here
1138
 */
1138
 */
1139
static int
1139
static int
1140
lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
1140
lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
1141
    uint16_t *crc, int sizefield_length, size_t limitsize, size_t *total_size)
1141
    uint16_t *crc, int sizefield_length, uint64_t limitsize, size_t *total_size)
1142
{
1142
{
1143
	const void *h;
1143
	const void *h;
1144
	const unsigned char *extdheader;
1144
	const unsigned char *extdheader;
Lines 1187-1194 lha_read_file_extended_header(struct archive_read *a, struct lha *lha, Link Here
1187
		}
1187
		}
1188
1188
1189
		/* Sanity check to the extended header size. */
1189
		/* Sanity check to the extended header size. */
1190
		if (((uint64_t)*total_size + extdsize) >
1190
		if (((uint64_t)*total_size + extdsize) > limitsize ||
1191
				    (uint64_t)limitsize ||
1192
		    extdsize <= (size_t)sizefield_length)
1191
		    extdsize <= (size_t)sizefield_length)
1193
			goto invalid;
1192
			goto invalid;
1194
1193
(-)b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c (-1 / +1 lines)
Lines 273-279 archive_read_support_format_mtree(struct archive *_a) Link Here
273
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
273
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
274
	    ARCHIVE_STATE_NEW, "archive_read_support_format_mtree");
274
	    ARCHIVE_STATE_NEW, "archive_read_support_format_mtree");
275
275
276
	mtree = (struct mtree *)calloc(1, sizeof(*mtree));
276
	mtree = calloc(1, sizeof(*mtree));
277
	if (mtree == NULL) {
277
	if (mtree == NULL) {
278
		archive_set_error(&a->archive, ENOMEM,
278
		archive_set_error(&a->archive, ENOMEM,
279
		    "Can't allocate mtree data");
279
		    "Can't allocate mtree data");
(-)b/contrib/libarchive/libarchive/archive_read_support_format_rar.c (-39 / +89 lines)
Lines 432-438 static int make_table_recurse(struct archive_read *, struct huffman_code *, int, Link Here
432
                              struct huffman_table_entry *, int, int);
432
                              struct huffman_table_entry *, int, int);
433
static int expand(struct archive_read *, int64_t *);
433
static int expand(struct archive_read *, int64_t *);
434
static int copy_from_lzss_window_to_unp(struct archive_read *, const void **,
434
static int copy_from_lzss_window_to_unp(struct archive_read *, const void **,
435
                                        int64_t, int);
435
                                        int64_t, size_t);
436
static const void *rar_read_ahead(struct archive_read *, size_t, ssize_t *);
436
static const void *rar_read_ahead(struct archive_read *, size_t, ssize_t *);
437
static int parse_filter(struct archive_read *, const uint8_t *, uint16_t,
437
static int parse_filter(struct archive_read *, const uint8_t *, uint16_t,
438
                        uint8_t);
438
                        uint8_t);
Lines 734-740 archive_read_support_format_rar(struct archive *_a) Link Here
734
  archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
734
  archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
735
                      "archive_read_support_format_rar");
735
                      "archive_read_support_format_rar");
736
736
737
  rar = (struct rar *)calloc(1, sizeof(*rar));
737
  rar = calloc(1, sizeof(*rar));
738
  if (rar == NULL)
738
  if (rar == NULL)
739
  {
739
  {
740
    archive_set_error(&a->archive, ENOMEM, "Can't allocate rar data");
740
    archive_set_error(&a->archive, ENOMEM, "Can't allocate rar data");
Lines 1371-1378 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1371
  char unp_size[8];
1371
  char unp_size[8];
1372
  int ttime;
1372
  int ttime;
1373
  struct archive_string_conv *sconv, *fn_sconv;
1373
  struct archive_string_conv *sconv, *fn_sconv;
1374
  unsigned long crc32_val;
1374
  uint32_t crc32_computed, crc32_read;
1375
  int ret = (ARCHIVE_OK), ret2;
1375
  int ret = (ARCHIVE_OK), ret2;
1376
  char *newptr;
1377
  size_t newsize;
1376
1378
1377
  rar = (struct rar *)(a->format->data);
1379
  rar = (struct rar *)(a->format->data);
1378
1380
Lines 1400-1406 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1400
      "Invalid header size");
1402
      "Invalid header size");
1401
    return (ARCHIVE_FATAL);
1403
    return (ARCHIVE_FATAL);
1402
  }
1404
  }
1403
  crc32_val = crc32(0, (const unsigned char *)p + 2, 7 - 2);
1405
  crc32_computed = crc32(0, (const unsigned char *)p + 2, 7 - 2);
1404
  __archive_read_consume(a, 7);
1406
  __archive_read_consume(a, 7);
1405
1407
1406
  if (!(rar->file_flags & FHD_SOLID))
1408
  if (!(rar->file_flags & FHD_SOLID))
Lines 1434-1441 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1434
    return (ARCHIVE_FATAL);
1436
    return (ARCHIVE_FATAL);
1435
1437
1436
  /* File Header CRC check. */
1438
  /* File Header CRC check. */
1437
  crc32_val = crc32(crc32_val, h, (unsigned)(header_size - 7));
1439
  crc32_computed = crc32(crc32_computed, h, (unsigned)(header_size - 7));
1438
  if ((crc32_val & 0xffff) != archive_le16dec(rar_header.crc)) {
1440
  crc32_read = archive_le16dec(rar_header.crc);
1441
  if ((crc32_computed & 0xffff) != crc32_read) {
1439
#ifndef DONT_FAIL_ON_CRC_ERROR
1442
#ifndef DONT_FAIL_ON_CRC_ERROR
1440
    archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1443
    archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1441
      "Header CRC error");
1444
      "Header CRC error");
Lines 1469-1474 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1469
1472
1470
  if (rar->file_flags & FHD_LARGE)
1473
  if (rar->file_flags & FHD_LARGE)
1471
  {
1474
  {
1475
    if (p + 8 > endp) {
1476
      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1477
                        "Invalid header size");
1478
      return (ARCHIVE_FATAL);
1479
    }
1472
    memcpy(packed_size, file_header.pack_size, 4);
1480
    memcpy(packed_size, file_header.pack_size, 4);
1473
    memcpy(packed_size + 4, p, 4); /* High pack size */
1481
    memcpy(packed_size + 4, p, 4); /* High pack size */
1474
    p += 4;
1482
    p += 4;
Lines 1514-1521 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1514
    return (ARCHIVE_FATAL);
1522
    return (ARCHIVE_FATAL);
1515
  }
1523
  }
1516
  if (rar->filename_allocated < filename_size * 2 + 2) {
1524
  if (rar->filename_allocated < filename_size * 2 + 2) {
1517
    char *newptr;
1525
    newsize = filename_size * 2 + 2;
1518
    size_t newsize = filename_size * 2 + 2;
1519
    newptr = realloc(rar->filename, newsize);
1526
    newptr = realloc(rar->filename, newsize);
1520
    if (newptr == NULL) {
1527
    if (newptr == NULL) {
1521
      archive_set_error(&a->archive, ENOMEM,
1528
      archive_set_error(&a->archive, ENOMEM,
Lines 1539-1545 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1539
      fn_end = filename_size * 2;
1546
      fn_end = filename_size * 2;
1540
      filename_size = 0;
1547
      filename_size = 0;
1541
      offset = (unsigned)strlen(filename) + 1;
1548
      offset = (unsigned)strlen(filename) + 1;
1542
      highbyte = *(p + offset++);
1549
      highbyte = offset >= end ? 0 : *(p + offset++);
1543
      flagbits = 0;
1550
      flagbits = 0;
1544
      flagbyte = 0;
1551
      flagbyte = 0;
1545
      while (offset < end && filename_size < fn_end)
1552
      while (offset < end && filename_size < fn_end)
Lines 1554-1567 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1554
        switch((flagbyte >> flagbits) & 3)
1561
        switch((flagbyte >> flagbits) & 3)
1555
        {
1562
        {
1556
          case 0:
1563
          case 0:
1564
            if (offset >= end)
1565
              continue;
1557
            filename[filename_size++] = '\0';
1566
            filename[filename_size++] = '\0';
1558
            filename[filename_size++] = *(p + offset++);
1567
            filename[filename_size++] = *(p + offset++);
1559
            break;
1568
            break;
1560
          case 1:
1569
          case 1:
1570
            if (offset >= end)
1571
              continue;
1561
            filename[filename_size++] = highbyte;
1572
            filename[filename_size++] = highbyte;
1562
            filename[filename_size++] = *(p + offset++);
1573
            filename[filename_size++] = *(p + offset++);
1563
            break;
1574
            break;
1564
          case 2:
1575
          case 2:
1576
            if (offset >= end - 1) {
1577
              offset = end;
1578
              continue;
1579
            }
1565
            filename[filename_size++] = *(p + offset + 1);
1580
            filename[filename_size++] = *(p + offset + 1);
1566
            filename[filename_size++] = *(p + offset);
1581
            filename[filename_size++] = *(p + offset);
1567
            offset += 2;
1582
            offset += 2;
Lines 1569-1577 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1569
          case 3:
1584
          case 3:
1570
          {
1585
          {
1571
            char extra, high;
1586
            char extra, high;
1572
            uint8_t length = *(p + offset++);
1587
            uint8_t length;
1573
1588
1589
            if (offset >= end)
1590
              continue;
1591
1592
            length = *(p + offset++);
1574
            if (length & 0x80) {
1593
            if (length & 0x80) {
1594
              if (offset >= end)
1595
                continue;
1575
              extra = *(p + offset++);
1596
              extra = *(p + offset++);
1576
              high = (char)highbyte;
1597
              high = (char)highbyte;
1577
            } else
1598
            } else
Lines 1652-1664 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1652
    rar->cursor++;
1673
    rar->cursor++;
1653
    if (rar->cursor >= rar->nodes)
1674
    if (rar->cursor >= rar->nodes)
1654
    {
1675
    {
1655
      rar->nodes++;
1676
      struct data_block_offsets *newdbo;
1656
      if ((rar->dbo =
1677
1657
        realloc(rar->dbo, sizeof(*rar->dbo) * rar->nodes)) == NULL)
1678
      newsize = sizeof(*rar->dbo) * (rar->nodes + 1);
1679
      if ((newdbo = realloc(rar->dbo, newsize)) == NULL)
1658
      {
1680
      {
1659
        archive_set_error(&a->archive, ENOMEM, "Couldn't allocate memory.");
1681
        archive_set_error(&a->archive, ENOMEM, "Couldn't allocate memory.");
1660
        return (ARCHIVE_FATAL);
1682
        return (ARCHIVE_FATAL);
1661
      }
1683
      }
1684
      rar->dbo = newdbo;
1685
      rar->nodes++;
1662
      rar->dbo[rar->cursor].header_size = header_size;
1686
      rar->dbo[rar->cursor].header_size = header_size;
1663
      rar->dbo[rar->cursor].start_offset = -1;
1687
      rar->dbo[rar->cursor].start_offset = -1;
1664
      rar->dbo[rar->cursor].end_offset = -1;
1688
      rar->dbo[rar->cursor].end_offset = -1;
Lines 1678-1686 read_header(struct archive_read *a, struct archive_entry *entry, Link Here
1678
    return (ARCHIVE_FATAL);
1702
    return (ARCHIVE_FATAL);
1679
  }
1703
  }
1680
1704
1681
  rar->filename_save = (char*)realloc(rar->filename_save,
1705
  newsize = filename_size + 1;
1682
                                      filename_size + 1);
1706
  if ((newptr = realloc(rar->filename_save, newsize)) == NULL)
1683
  memcpy(rar->filename_save, rar->filename, filename_size + 1);
1707
  {
1708
    archive_set_error(&a->archive, ENOMEM, "Couldn't allocate memory.");
1709
    return (ARCHIVE_FATAL);
1710
  }
1711
  rar->filename_save = newptr;
1712
  memcpy(rar->filename_save, rar->filename, newsize);
1684
  rar->filename_save_size = filename_size;
1713
  rar->filename_save_size = filename_size;
1685
1714
1686
  /* Set info for seeking */
1715
  /* Set info for seeking */
Lines 2060-2066 read_data_compressed(struct archive_read *a, const void **buff, size_t *size, Link Here
2060
        bs = rar->unp_buffer_size - rar->unp_offset;
2089
        bs = rar->unp_buffer_size - rar->unp_offset;
2061
      else
2090
      else
2062
        bs = (size_t)rar->bytes_uncopied;
2091
        bs = (size_t)rar->bytes_uncopied;
2063
      ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, (int)bs);
2092
      ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, bs);
2064
      if (ret != ARCHIVE_OK)
2093
      if (ret != ARCHIVE_OK)
2065
        return (ret);
2094
        return (ret);
2066
      rar->offset += bs;
2095
      rar->offset += bs;
Lines 2213-2219 read_data_compressed(struct archive_read *a, const void **buff, size_t *size, Link Here
2213
      bs = rar->unp_buffer_size - rar->unp_offset;
2242
      bs = rar->unp_buffer_size - rar->unp_offset;
2214
    else
2243
    else
2215
      bs = (size_t)rar->bytes_uncopied;
2244
      bs = (size_t)rar->bytes_uncopied;
2216
    ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, (int)bs);
2245
    ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, bs);
2217
    if (ret != ARCHIVE_OK)
2246
    if (ret != ARCHIVE_OK)
2218
      return (ret);
2247
      return (ret);
2219
    rar->offset += bs;
2248
    rar->offset += bs;
Lines 2579-2586 read_next_symbol(struct archive_read *a, struct huffman_code *code) Link Here
2579
  rar_br_consume(br, code->tablesize);
2608
  rar_br_consume(br, code->tablesize);
2580
2609
2581
  node = value;
2610
  node = value;
2582
  while (!(code->tree[node].branches[0] ==
2611
  while (code->tree[node].branches[0] != code->tree[node].branches[1])
2583
    code->tree[node].branches[1]))
2584
  {
2612
  {
2585
    if (!rar_br_read_ahead(a, br, 1)) {
2613
    if (!rar_br_read_ahead(a, br, 1)) {
2586
      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2614
      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
Lines 2775-2783 make_table(struct archive_read *a, struct huffman_code *code) Link Here
2775
  else
2803
  else
2776
    code->tablesize = code->maxlength;
2804
    code->tablesize = code->maxlength;
2777
2805
2778
  code->table =
2806
  code->table = calloc(1U << code->tablesize, sizeof(*code->table));
2779
    (struct huffman_table_entry *)calloc(1, sizeof(*code->table)
2780
    * ((size_t)1 << code->tablesize));
2781
2807
2782
  return make_table_recurse(a, code, 0, code->table, 0, code->tablesize);
2808
  return make_table_recurse(a, code, 0, code->table, 0, code->tablesize);
2783
}
2809
}
Lines 2955-2961 expand(struct archive_read *a, int64_t *end) Link Here
2955
2981
2956
      if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0)
2982
      if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0)
2957
        goto bad_data;
2983
        goto bad_data;
2958
      if (lensymbol > lengthb_min)
2984
      if (lensymbol >= lengthb_min)
2959
        goto bad_data;
2985
        goto bad_data;
2960
      len = lengthbases[lensymbol] + 2;
2986
      len = lengthbases[lensymbol] + 2;
2961
      if (lengthbits[lensymbol] > 0) {
2987
      if (lengthbits[lensymbol] > 0) {
Lines 2987-2993 expand(struct archive_read *a, int64_t *end) Link Here
2987
    }
3013
    }
2988
    else
3014
    else
2989
    {
3015
    {
2990
      if (symbol-271 > lengthb_min)
3016
      if (symbol-271 >= lengthb_min)
2991
        goto bad_data;
3017
        goto bad_data;
2992
      len = lengthbases[symbol-271]+3;
3018
      len = lengthbases[symbol-271]+3;
2993
      if(lengthbits[symbol-271] > 0) {
3019
      if(lengthbits[symbol-271] > 0) {
Lines 2999-3005 expand(struct archive_read *a, int64_t *end) Link Here
2999
3025
3000
      if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0)
3026
      if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0)
3001
        goto bad_data;
3027
        goto bad_data;
3002
      if (offssymbol > offsetb_min)
3028
      if (offssymbol >= offsetb_min)
3003
        goto bad_data;
3029
        goto bad_data;
3004
      offs = offsetbases[offssymbol]+1;
3030
      offs = offsetbases[offssymbol]+1;
3005
      if(offsetbits[offssymbol] > 0)
3031
      if(offsetbits[offssymbol] > 0)
Lines 3094-3104 copy_from_lzss_window(struct archive_read *a, void *buffer, Link Here
3094
3120
3095
static int
3121
static int
3096
copy_from_lzss_window_to_unp(struct archive_read *a, const void **buffer,
3122
copy_from_lzss_window_to_unp(struct archive_read *a, const void **buffer,
3097
                             int64_t startpos, int length)
3123
                             int64_t startpos, size_t length)
3098
{
3124
{
3099
  int windowoffs, firstpart;
3125
  int windowoffs, firstpart;
3100
  struct rar *rar = (struct rar *)(a->format->data);
3126
  struct rar *rar = (struct rar *)(a->format->data);
3101
3127
3128
  if (length > rar->unp_buffer_size)
3129
  {
3130
    goto fatal;
3131
  }
3132
3102
  if (!rar->unp_buffer)
3133
  if (!rar->unp_buffer)
3103
  {
3134
  {
3104
    if ((rar->unp_buffer = malloc(rar->unp_buffer_size)) == NULL)
3135
    if ((rar->unp_buffer = malloc(rar->unp_buffer_size)) == NULL)
Lines 3110-3126 copy_from_lzss_window_to_unp(struct archive_read *a, const void **buffer, Link Here
3110
  }
3141
  }
3111
3142
3112
  windowoffs = lzss_offset_for_position(&rar->lzss, startpos);
3143
  windowoffs = lzss_offset_for_position(&rar->lzss, startpos);
3113
  if(windowoffs + length <= lzss_size(&rar->lzss)) {
3144
  if(windowoffs + length <= (size_t)lzss_size(&rar->lzss)) {
3114
    memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs],
3145
    memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs],
3115
           length);
3146
           length);
3116
  } else if (length <= lzss_size(&rar->lzss)) {
3147
  } else if (length <= (size_t)lzss_size(&rar->lzss)) {
3117
    firstpart = lzss_size(&rar->lzss) - windowoffs;
3148
    firstpart = lzss_size(&rar->lzss) - windowoffs;
3118
    if (firstpart < 0) {
3149
    if (firstpart < 0) {
3119
      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
3150
      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
3120
                        "Bad RAR file data");
3151
                        "Bad RAR file data");
3121
      return (ARCHIVE_FATAL);
3152
      return (ARCHIVE_FATAL);
3122
    }
3153
    }
3123
    if (firstpart < length) {
3154
    if ((size_t)firstpart < length) {
3124
      memcpy(&rar->unp_buffer[rar->unp_offset],
3155
      memcpy(&rar->unp_buffer[rar->unp_offset],
3125
             &rar->lzss.window[windowoffs], firstpart);
3156
             &rar->lzss.window[windowoffs], firstpart);
3126
      memcpy(&rar->unp_buffer[rar->unp_offset + firstpart],
3157
      memcpy(&rar->unp_buffer[rar->unp_offset + firstpart],
Lines 3130-3145 copy_from_lzss_window_to_unp(struct archive_read *a, const void **buffer, Link Here
3130
             &rar->lzss.window[windowoffs], length);
3161
             &rar->lzss.window[windowoffs], length);
3131
    }
3162
    }
3132
  } else {
3163
  } else {
3133
      archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
3164
      goto fatal;
3134
                        "Bad RAR file data");
3135
      return (ARCHIVE_FATAL);
3136
  }
3165
  }
3137
  rar->unp_offset += length;
3166
  rar->unp_offset += (unsigned int) length;
3138
  if (rar->unp_offset >= rar->unp_buffer_size)
3167
  if (rar->unp_offset >= rar->unp_buffer_size)
3139
    *buffer = rar->unp_buffer;
3168
    *buffer = rar->unp_buffer;
3140
  else
3169
  else
3141
    *buffer = NULL;
3170
    *buffer = NULL;
3142
  return (ARCHIVE_OK);
3171
  return (ARCHIVE_OK);
3172
3173
fatal:
3174
  archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
3175
                    "Bad RAR file data");
3176
  return (ARCHIVE_FATAL);
3143
}
3177
}
3144
3178
3145
static const void *
3179
static const void *
Lines 3325-3331 create_filter(struct rar_program_code *prog, const uint8_t *globaldata, uint32_t Link Here
3325
  filter->globaldatalen = globaldatalen > PROGRAM_SYSTEM_GLOBAL_SIZE ? globaldatalen : PROGRAM_SYSTEM_GLOBAL_SIZE;
3359
  filter->globaldatalen = globaldatalen > PROGRAM_SYSTEM_GLOBAL_SIZE ? globaldatalen : PROGRAM_SYSTEM_GLOBAL_SIZE;
3326
  filter->globaldata = calloc(1, filter->globaldatalen);
3360
  filter->globaldata = calloc(1, filter->globaldatalen);
3327
  if (!filter->globaldata)
3361
  if (!filter->globaldata)
3362
  {
3363
    free(filter);
3328
    return NULL;
3364
    return NULL;
3365
  }
3329
  if (globaldata)
3366
  if (globaldata)
3330
    memcpy(filter->globaldata, globaldata, globaldatalen);
3367
    memcpy(filter->globaldata, globaldata, globaldatalen);
3331
  if (registers)
3368
  if (registers)
Lines 3352-3358 run_filters(struct archive_read *a) Link Here
3352
  if (filters == NULL || filter == NULL)
3389
  if (filters == NULL || filter == NULL)
3353
    return (0);
3390
    return (0);
3354
3391
3355
  start = filters->filterstart;
3392
  start = (size_t)filters->filterstart;
3356
  end = start + filter->blocklength;
3393
  end = start + filter->blocklength;
3357
3394
3358
  filters->filterstart = INT64_MAX;
3395
  filters->filterstart = INT64_MAX;
Lines 3389-3398 run_filters(struct archive_read *a) Link Here
3389
      return 0;
3426
      return 0;
3390
  }
3427
  }
3391
3428
3429
  if (filter->blocklength > VM_MEMORY_SIZE)
3430
  {
3431
    archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Bad RAR file data");
3432
    return 0;
3433
  }
3434
3392
  ret = copy_from_lzss_window(a, filters->vm->memory, start, filter->blocklength);
3435
  ret = copy_from_lzss_window(a, filters->vm->memory, start, filter->blocklength);
3393
  if (ret != ARCHIVE_OK)
3436
  if (ret != ARCHIVE_OK)
3394
    return 0;
3437
    return 0;
3395
  if (!execute_filter(a, filter, filters->vm, rar->offset))
3438
  if (!execute_filter(a, filter, filters->vm, (size_t)rar->offset))
3396
    return 0;
3439
    return 0;
3397
3440
3398
  lastfilteraddress = filter->filteredblockaddress;
3441
  lastfilteraddress = filter->filteredblockaddress;
Lines 3404-3410 run_filters(struct archive_read *a) Link Here
3404
  while ((filter = filters->stack) != NULL && (int64_t)filter->blockstartpos == filters->filterstart && filter->blocklength == lastfilterlength)
3447
  while ((filter = filters->stack) != NULL && (int64_t)filter->blockstartpos == filters->filterstart && filter->blocklength == lastfilterlength)
3405
  {
3448
  {
3406
    memmove(&filters->vm->memory[0], &filters->vm->memory[lastfilteraddress], lastfilterlength);
3449
    memmove(&filters->vm->memory[0], &filters->vm->memory[lastfilteraddress], lastfilterlength);
3407
    if (!execute_filter(a, filter, filters->vm, rar->offset))
3450
    if (!execute_filter(a, filter, filters->vm, (size_t)rar->offset))
3408
      return 0;
3451
      return 0;
3409
3452
3410
    lastfilteraddress = filter->filteredblockaddress;
3453
    lastfilteraddress = filter->filteredblockaddress;
Lines 3645-3651 execute_filter_e8(struct rar_filter *filter, struct rar_virtual_machine *vm, siz Link Here
3645
    {
3688
    {
3646
      uint32_t currpos = (uint32_t)pos + i + 1;
3689
      uint32_t currpos = (uint32_t)pos + i + 1;
3647
      int32_t address = (int32_t)vm_read_32(vm, i + 1);
3690
      int32_t address = (int32_t)vm_read_32(vm, i + 1);
3648
      if (address < 0 && currpos >= (uint32_t)-address)
3691
      if (address < 0 && currpos >= (~(uint32_t)address + 1))
3649
        vm_write_32(vm, i + 1, address + filesize);
3692
        vm_write_32(vm, i + 1, address + filesize);
3650
      else if (address >= 0 && (uint32_t)address < filesize)
3693
      else if (address >= 0 && (uint32_t)address < filesize)
3651
        vm_write_32(vm, i + 1, address - currpos);
3694
        vm_write_32(vm, i + 1, address - currpos);
Lines 3668-3674 execute_filter_rgb(struct rar_filter *filter, struct rar_virtual_machine *vm) Link Here
3668
  uint8_t *src, *dst;
3711
  uint8_t *src, *dst;
3669
  uint32_t i, j;
3712
  uint32_t i, j;
3670
3713
3671
  if (blocklength > PROGRAM_WORK_SIZE / 2 || stride > blocklength)
3714
  if (blocklength > PROGRAM_WORK_SIZE / 2 || stride > blocklength || blocklength < 3 || byteoffset > 2)
3672
    return 0;
3715
    return 0;
3673
3716
3674
  src = &vm->memory[0];
3717
  src = &vm->memory[0];
Lines 3678-3683 execute_filter_rgb(struct rar_filter *filter, struct rar_virtual_machine *vm) Link Here
3678
    uint8_t *prev = dst + i - stride;
3721
    uint8_t *prev = dst + i - stride;
3679
    for (j = i; j < blocklength; j += 3)
3722
    for (j = i; j < blocklength; j += 3)
3680
    {
3723
    {
3724
      /*
3725
       * The src block should not overlap with the dst block.
3726
       * If so it would be better to consider this archive is broken.
3727
       */
3728
      if (src >= dst)
3729
        return 0;
3730
3681
      if (prev >= dst)
3731
      if (prev >= dst)
3682
      {
3732
      {
3683
        uint32_t delta1 = abs(prev[3] - prev[0]);
3733
        uint32_t delta1 = abs(prev[3] - prev[0]);
(-)b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c (-49 / +122 lines)
Lines 210-216 struct comp_state { Link Here
210
	   or just a part of it. */
210
	   or just a part of it. */
211
	uint8_t block_parsing_finished : 1;
211
	uint8_t block_parsing_finished : 1;
212
212
213
	signed int notused : 4;
213
	/* Flag used to indicate that a previous file using this buffer was
214
	   encrypted, meaning no data in the buffer can be trusted */
215
	uint8_t data_encrypted : 1;
216
217
	signed int notused : 3;
214
218
215
	int flags;                   /* Uncompression flags. */
219
	int flags;                   /* Uncompression flags. */
216
	int method;                  /* Uncompression algorithm method. */
220
	int method;                  /* Uncompression algorithm method. */
Lines 220-226 struct comp_state { Link Here
220
	                                decompression. */
224
	                                decompression. */
221
	uint8_t* filtered_buf;       /* Buffer used when applying filters. */
225
	uint8_t* filtered_buf;       /* Buffer used when applying filters. */
222
	const uint8_t* block_buf;    /* Buffer used when merging blocks. */
226
	const uint8_t* block_buf;    /* Buffer used when merging blocks. */
223
	size_t window_mask;          /* Convenience field; window_size - 1. */
227
	ssize_t window_mask;         /* Convenience field; window_size - 1. */
224
	int64_t write_ptr;           /* This amount of data has been unpacked
228
	int64_t write_ptr;           /* This amount of data has been unpacked
225
					in the window buffer. */
229
					in the window buffer. */
226
	int64_t last_write_ptr;      /* This amount of data has been stored in
230
	int64_t last_write_ptr;      /* This amount of data has been stored in
Lines 352-357 struct rar5 { Link Here
352
	/* The header of currently processed RARv5 block. Used in main
356
	/* The header of currently processed RARv5 block. Used in main
353
	 * decompression logic loop. */
357
	 * decompression logic loop. */
354
	struct compressed_block_header last_block_hdr;
358
	struct compressed_block_header last_block_hdr;
359
360
	/*
361
	 * Custom field to denote that this archive contains encrypted entries
362
	 */
363
	int has_encrypted_entries;
364
	int headers_are_encrypted;
355
};
365
};
356
366
357
/* Forward function declarations. */
367
/* Forward function declarations. */
Lines 361-366 static int verify_global_checksums(struct archive_read* a); Link Here
361
static int rar5_read_data_skip(struct archive_read *a);
371
static int rar5_read_data_skip(struct archive_read *a);
362
static int push_data_ready(struct archive_read* a, struct rar5* rar,
372
static int push_data_ready(struct archive_read* a, struct rar5* rar,
363
	const uint8_t* buf, size_t size, int64_t offset);
373
	const uint8_t* buf, size_t size, int64_t offset);
374
static void clear_data_ready_stack(struct rar5* rar);
364
375
365
/* CDE_xxx = Circular Double Ended (Queue) return values. */
376
/* CDE_xxx = Circular Double Ended (Queue) return values. */
366
enum CDE_RETURN_VALUES {
377
enum CDE_RETURN_VALUES {
Lines 505-511 static inline struct rar5* get_context(struct archive_read* a) { Link Here
505
}
516
}
506
517
507
/* Convenience functions used by filter implementations. */
518
/* Convenience functions used by filter implementations. */
508
static void circular_memcpy(uint8_t* dst, uint8_t* window, const uint64_t mask,
519
static void circular_memcpy(uint8_t* dst, uint8_t* window, const ssize_t mask,
509
    int64_t start, int64_t end)
520
    int64_t start, int64_t end)
510
{
521
{
511
	if((start & mask) > (end & mask)) {
522
	if((start & mask) > (end & mask)) {
Lines 534-541 static void write_filter_data(struct rar5* rar, uint32_t offset, Link Here
534
545
535
/* Allocates a new filter descriptor and adds it to the filter array. */
546
/* Allocates a new filter descriptor and adds it to the filter array. */
536
static struct filter_info* add_new_filter(struct rar5* rar) {
547
static struct filter_info* add_new_filter(struct rar5* rar) {
537
	struct filter_info* f =
548
	struct filter_info* f = calloc(1, sizeof(*f));
538
		(struct filter_info*) calloc(1, sizeof(struct filter_info));
539
549
540
	if(!f) {
550
	if(!f) {
541
		return NULL;
551
		return NULL;
Lines 652-657 static int run_filter(struct archive_read* a, struct filter_info* flt) { Link Here
652
	int ret;
662
	int ret;
653
	struct rar5* rar = get_context(a);
663
	struct rar5* rar = get_context(a);
654
664
665
	clear_data_ready_stack(rar);
655
	free(rar->cstate.filtered_buf);
666
	free(rar->cstate.filtered_buf);
656
667
657
	rar->cstate.filtered_buf = malloc(flt->block_length);
668
	rar->cstate.filtered_buf = malloc(flt->block_length);
Lines 709-715 static int run_filter(struct archive_read* a, struct filter_info* flt) { Link Here
709
static void push_data(struct archive_read* a, struct rar5* rar,
720
static void push_data(struct archive_read* a, struct rar5* rar,
710
    const uint8_t* buf, int64_t idx_begin, int64_t idx_end)
721
    const uint8_t* buf, int64_t idx_begin, int64_t idx_end)
711
{
722
{
712
	const uint64_t wmask = rar->cstate.window_mask;
723
	const ssize_t wmask = rar->cstate.window_mask;
713
	const ssize_t solid_write_ptr = (rar->cstate.solid_offset +
724
	const ssize_t solid_write_ptr = (rar->cstate.solid_offset +
714
	    rar->cstate.last_write_ptr) & wmask;
725
	    rar->cstate.last_write_ptr) & wmask;
715
726
Lines 1246-1252 static int process_main_locator_extra_block(struct archive_read* a, Link Here
1246
}
1257
}
1247
1258
1248
static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar,
1259
static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar,
1249
    ssize_t* extra_data_size)
1260
    int64_t* extra_data_size)
1250
{
1261
{
1251
	size_t hash_type = 0;
1262
	size_t hash_type = 0;
1252
	size_t value_len;
1263
	size_t value_len;
Lines 1296-1302 static uint64_t time_win_to_unix(uint64_t win_time) { Link Here
1296
}
1307
}
1297
1308
1298
static int parse_htime_item(struct archive_read* a, char unix_time,
1309
static int parse_htime_item(struct archive_read* a, char unix_time,
1299
    uint64_t* where, ssize_t* extra_data_size)
1310
    uint64_t* where, int64_t* extra_data_size)
1300
{
1311
{
1301
	if(unix_time) {
1312
	if(unix_time) {
1302
		uint32_t time_val;
1313
		uint32_t time_val;
Lines 1318-1324 static int parse_htime_item(struct archive_read* a, char unix_time, Link Here
1318
}
1329
}
1319
1330
1320
static int parse_file_extra_version(struct archive_read* a,
1331
static int parse_file_extra_version(struct archive_read* a,
1321
    struct archive_entry* e, ssize_t* extra_data_size)
1332
    struct archive_entry* e, int64_t* extra_data_size)
1322
{
1333
{
1323
	size_t flags = 0;
1334
	size_t flags = 0;
1324
	size_t version = 0;
1335
	size_t version = 0;
Lines 1372-1378 static int parse_file_extra_version(struct archive_read* a, Link Here
1372
}
1383
}
1373
1384
1374
static int parse_file_extra_htime(struct archive_read* a,
1385
static int parse_file_extra_htime(struct archive_read* a,
1375
    struct archive_entry* e, struct rar5* rar, ssize_t* extra_data_size)
1386
    struct archive_entry* e, struct rar5* rar, int64_t* extra_data_size)
1376
{
1387
{
1377
	char unix_time = 0;
1388
	char unix_time = 0;
1378
	size_t flags = 0;
1389
	size_t flags = 0;
Lines 1425-1431 static int parse_file_extra_htime(struct archive_read* a, Link Here
1425
}
1436
}
1426
1437
1427
static int parse_file_extra_redir(struct archive_read* a,
1438
static int parse_file_extra_redir(struct archive_read* a,
1428
    struct archive_entry* e, struct rar5* rar, ssize_t* extra_data_size)
1439
    struct archive_entry* e, struct rar5* rar, int64_t* extra_data_size)
1429
{
1440
{
1430
	uint64_t value_size = 0;
1441
	uint64_t value_size = 0;
1431
	size_t target_size = 0;
1442
	size_t target_size = 0;
Lines 1448-1456 static int parse_file_extra_redir(struct archive_read* a, Link Here
1448
		return ARCHIVE_EOF;
1459
		return ARCHIVE_EOF;
1449
	*extra_data_size -= target_size + 1;
1460
	*extra_data_size -= target_size + 1;
1450
1461
1451
	if(!read_ahead(a, target_size, &p))
1452
		return ARCHIVE_EOF;
1453
1454
	if(target_size > (MAX_NAME_IN_CHARS - 1)) {
1462
	if(target_size > (MAX_NAME_IN_CHARS - 1)) {
1455
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1463
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1456
		    "Link target is too long");
1464
		    "Link target is too long");
Lines 1463-1468 static int parse_file_extra_redir(struct archive_read* a, Link Here
1463
		return ARCHIVE_FATAL;
1471
		return ARCHIVE_FATAL;
1464
	}
1472
	}
1465
1473
1474
	if(!read_ahead(a, target_size, &p))
1475
		return ARCHIVE_EOF;
1476
1466
	memcpy(target_utf8_buf, p, target_size);
1477
	memcpy(target_utf8_buf, p, target_size);
1467
	target_utf8_buf[target_size] = 0;
1478
	target_utf8_buf[target_size] = 0;
1468
1479
Lines 1496-1502 static int parse_file_extra_redir(struct archive_read* a, Link Here
1496
}
1507
}
1497
1508
1498
static int parse_file_extra_owner(struct archive_read* a,
1509
static int parse_file_extra_owner(struct archive_read* a,
1499
    struct archive_entry* e, ssize_t* extra_data_size)
1510
    struct archive_entry* e, int64_t* extra_data_size)
1500
{
1511
{
1501
	uint64_t flags = 0;
1512
	uint64_t flags = 0;
1502
	uint64_t value_size = 0;
1513
	uint64_t value_size = 0;
Lines 1576-1590 static int parse_file_extra_owner(struct archive_read* a, Link Here
1576
}
1587
}
1577
1588
1578
static int process_head_file_extra(struct archive_read* a,
1589
static int process_head_file_extra(struct archive_read* a,
1579
    struct archive_entry* e, struct rar5* rar, ssize_t extra_data_size)
1590
    struct archive_entry* e, struct rar5* rar, int64_t extra_data_size)
1580
{
1591
{
1581
	size_t extra_field_size;
1592
	uint64_t extra_field_size;
1582
	size_t extra_field_id = 0;
1593
	uint64_t extra_field_id = 0;
1583
	int ret = ARCHIVE_FATAL;
1594
	int ret = ARCHIVE_FATAL;
1584
	size_t var_size;
1595
	uint64_t var_size;
1585
1596
1586
	while(extra_data_size > 0) {
1597
	while(extra_data_size > 0) {
1587
		if(!read_var_sized(a, &extra_field_size, &var_size))
1598
		if(!read_var(a, &extra_field_size, &var_size))
1588
			return ARCHIVE_EOF;
1599
			return ARCHIVE_EOF;
1589
1600
1590
		extra_data_size -= var_size;
1601
		extra_data_size -= var_size;
Lines 1592-1600 static int process_head_file_extra(struct archive_read* a, Link Here
1592
			return ARCHIVE_EOF;
1603
			return ARCHIVE_EOF;
1593
		}
1604
		}
1594
1605
1595
		if(!read_var_sized(a, &extra_field_id, &var_size))
1606
		if(!read_var(a, &extra_field_id, &var_size))
1596
			return ARCHIVE_EOF;
1607
			return ARCHIVE_EOF;
1597
1608
1609
		extra_field_size -= var_size;
1598
		extra_data_size -= var_size;
1610
		extra_data_size -= var_size;
1599
		if(ARCHIVE_OK != consume(a, var_size)) {
1611
		if(ARCHIVE_OK != consume(a, var_size)) {
1600
			return ARCHIVE_EOF;
1612
			return ARCHIVE_EOF;
Lines 1622-1633 static int process_head_file_extra(struct archive_read* a, Link Here
1622
				    &extra_data_size);
1634
				    &extra_data_size);
1623
				break;
1635
				break;
1624
			case EX_CRYPT:
1636
			case EX_CRYPT:
1637
				/* Mark the entry as encrypted */
1638
				archive_entry_set_is_data_encrypted(e, 1);
1639
				rar->has_encrypted_entries = 1;
1640
				rar->cstate.data_encrypted = 1;
1625
				/* fallthrough */
1641
				/* fallthrough */
1626
			case EX_SUBDATA:
1642
			case EX_SUBDATA:
1627
				/* fallthrough */
1643
				/* fallthrough */
1628
			default:
1644
			default:
1629
				/* Skip unsupported entry. */
1645
				/* Skip unsupported entry. */
1630
				return consume(a, extra_data_size);
1646
				extra_data_size -= extra_field_size;
1647
				if (ARCHIVE_OK != consume(a, extra_field_size)) {
1648
					return ARCHIVE_EOF;
1649
				}
1631
		}
1650
		}
1632
	}
1651
	}
1633
1652
Lines 1642-1648 static int process_head_file_extra(struct archive_read* a, Link Here
1642
static int process_head_file(struct archive_read* a, struct rar5* rar,
1661
static int process_head_file(struct archive_read* a, struct rar5* rar,
1643
    struct archive_entry* entry, size_t block_flags)
1662
    struct archive_entry* entry, size_t block_flags)
1644
{
1663
{
1645
	ssize_t extra_data_size = 0;
1664
	int64_t extra_data_size = 0;
1646
	size_t data_size = 0;
1665
	size_t data_size = 0;
1647
	size_t file_flags = 0;
1666
	size_t file_flags = 0;
1648
	size_t file_attr = 0;
1667
	size_t file_attr = 0;
Lines 1682-1693 static int process_head_file(struct archive_read* a, struct rar5* rar, Link Here
1682
	}
1701
	}
1683
1702
1684
	if(block_flags & HFL_EXTRA_DATA) {
1703
	if(block_flags & HFL_EXTRA_DATA) {
1685
		size_t edata_size = 0;
1704
		uint64_t edata_size = 0;
1686
		if(!read_var_sized(a, &edata_size, NULL))
1705
		if(!read_var(a, &edata_size, NULL))
1687
			return ARCHIVE_EOF;
1706
			return ARCHIVE_EOF;
1688
1707
1689
		/* Intentional type cast from unsigned to signed. */
1708
		/* Intentional type cast from unsigned to signed. */
1690
		extra_data_size = (ssize_t) edata_size;
1709
		extra_data_size = (int64_t) edata_size;
1691
	}
1710
	}
1692
1711
1693
	if(block_flags & HFL_DATA) {
1712
	if(block_flags & HFL_DATA) {
Lines 1745-1753 static int process_head_file(struct archive_read* a, struct rar5* rar, Link Here
1745
	rar->file.solid = (compression_info & SOLID) > 0;
1764
	rar->file.solid = (compression_info & SOLID) > 0;
1746
1765
1747
	/* Archives which declare solid files without initializing the window
1766
	/* Archives which declare solid files without initializing the window
1748
	 * buffer first are invalid. */
1767
	 * buffer first are invalid, unless previous data was encrypted, in
1768
	 * which case we may never have had the chance */
1749
1769
1750
	if(rar->file.solid > 0 && rar->cstate.window_buf == NULL) {
1770
	if(rar->file.solid > 0 && rar->cstate.data_encrypted == 0 &&
1771
	    rar->cstate.window_buf == NULL) {
1751
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1772
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1752
				  "Declared solid file, but no window buffer "
1773
				  "Declared solid file, but no window buffer "
1753
				  "initialized yet.");
1774
				  "initialized yet.");
Lines 1776-1790 static int process_head_file(struct archive_read* a, struct rar5* rar, Link Here
1776
			return ARCHIVE_FATAL;
1797
			return ARCHIVE_FATAL;
1777
		}
1798
		}
1778
	}
1799
	}
1800
	else
1801
		rar->cstate.data_encrypted = 0; /* Reset for new buffer */
1779
1802
1780
	if(rar->cstate.window_size < (ssize_t) window_size &&
1803
	if(rar->cstate.window_size < (ssize_t) window_size &&
1781
	    rar->cstate.window_buf)
1804
	    rar->cstate.window_buf)
1782
	{
1805
	{
1806
		/* The `data_ready` stack contains pointers to the `window_buf` or
1807
		 * `filtered_buf` buffers.  Since we're about to reallocate the first
1808
		 * buffer, some of those pointers could become invalid. Therefore, we
1809
		 * need to dispose of all entries from the stack before attempting the
1810
		 * realloc. */
1811
		clear_data_ready_stack(rar);
1812
1783
		/* If window_buf has been allocated before, reallocate it, so
1813
		/* If window_buf has been allocated before, reallocate it, so
1784
		 * that its size will match new window_size. */
1814
		 * that its size will match new window_size. */
1785
1815
1786
		uint8_t* new_window_buf =
1816
		uint8_t* new_window_buf =
1787
			realloc(rar->cstate.window_buf, window_size);
1817
			realloc(rar->cstate.window_buf, (size_t) window_size);
1788
1818
1789
		if(!new_window_buf) {
1819
		if(!new_window_buf) {
1790
			archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
1820
			archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
Lines 1837-1863 static int process_head_file(struct archive_read* a, struct rar5* rar, Link Here
1837
1867
1838
		if (file_attr & (ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM)) {
1868
		if (file_attr & (ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM)) {
1839
			char *fflags_text, *ptr;
1869
			char *fflags_text, *ptr;
1840
			/* allocate for "rdonly,hidden,system," */
1870
			/* allocate for ",rdonly,hidden,system" */
1841
			fflags_text = malloc(22 * sizeof(char));
1871
			fflags_text = malloc(22 * sizeof(*fflags_text));
1842
			if (fflags_text != NULL) {
1872
			if (fflags_text != NULL) {
1843
				ptr = fflags_text;
1873
				ptr = fflags_text;
1844
				if (file_attr & ATTR_READONLY) {
1874
				if (file_attr & ATTR_READONLY) {
1845
					strcpy(ptr, "rdonly,");
1875
					strcpy(ptr, ",rdonly");
1846
					ptr = ptr + 7;
1876
					ptr = ptr + 7;
1847
				}
1877
				}
1848
				if (file_attr & ATTR_HIDDEN) {
1878
				if (file_attr & ATTR_HIDDEN) {
1849
					strcpy(ptr, "hidden,");
1879
					strcpy(ptr, ",hidden");
1850
					ptr = ptr + 7;
1880
					ptr = ptr + 7;
1851
				}
1881
				}
1852
				if (file_attr & ATTR_SYSTEM) {
1882
				if (file_attr & ATTR_SYSTEM) {
1853
					strcpy(ptr, "system,");
1883
					strcpy(ptr, ",system");
1854
					ptr = ptr + 7;
1884
					ptr = ptr + 7;
1855
				}
1885
				}
1856
				if (ptr > fflags_text) {
1886
				if (ptr > fflags_text) {
1857
					/* Delete trailing comma */
1858
					*(ptr - 1) = '\0';
1859
					archive_entry_copy_fflags_text(entry,
1887
					archive_entry_copy_fflags_text(entry,
1860
					    fflags_text);
1888
					    fflags_text + 1);
1861
				}
1889
				}
1862
				free(fflags_text);
1890
				free(fflags_text);
1863
			}
1891
			}
Lines 1876-1884 static int process_head_file(struct archive_read* a, struct rar5* rar, Link Here
1876
	if(!read_var_sized(a, &name_size, NULL))
1904
	if(!read_var_sized(a, &name_size, NULL))
1877
		return ARCHIVE_EOF;
1905
		return ARCHIVE_EOF;
1878
1906
1879
	if(!read_ahead(a, name_size, &p))
1880
		return ARCHIVE_EOF;
1881
1882
	if(name_size > (MAX_NAME_IN_CHARS - 1)) {
1907
	if(name_size > (MAX_NAME_IN_CHARS - 1)) {
1883
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1908
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
1884
				"Filename is too long");
1909
				"Filename is too long");
Lines 1893-1898 static int process_head_file(struct archive_read* a, struct rar5* rar, Link Here
1893
		return ARCHIVE_FATAL;
1918
		return ARCHIVE_FATAL;
1894
	}
1919
	}
1895
1920
1921
	if(!read_ahead(a, name_size, &p))
1922
		return ARCHIVE_EOF;
1923
1896
	memcpy(name_utf8_buf, p, name_size);
1924
	memcpy(name_utf8_buf, p, name_size);
1897
	name_utf8_buf[name_size] = 0;
1925
	name_utf8_buf[name_size] = 0;
1898
	if(ARCHIVE_OK != consume(a, name_size)) {
1926
	if(ARCHIVE_OK != consume(a, name_size)) {
Lines 1980-1986 static int process_head_main(struct archive_read* a, struct rar5* rar, Link Here
1980
    struct archive_entry* entry, size_t block_flags)
2008
    struct archive_entry* entry, size_t block_flags)
1981
{
2009
{
1982
	int ret;
2010
	int ret;
1983
	size_t extra_data_size = 0;
2011
	uint64_t extra_data_size = 0;
1984
	size_t extra_field_size = 0;
2012
	size_t extra_field_size = 0;
1985
	size_t extra_field_id = 0;
2013
	size_t extra_field_id = 0;
1986
	size_t archive_flags = 0;
2014
	size_t archive_flags = 0;
Lines 2002-2008 static int process_head_main(struct archive_read* a, struct rar5* rar, Link Here
2002
	(void) entry;
2030
	(void) entry;
2003
2031
2004
	if(block_flags & HFL_EXTRA_DATA) {
2032
	if(block_flags & HFL_EXTRA_DATA) {
2005
		if(!read_var_sized(a, &extra_data_size, NULL))
2033
		if(!read_var(a, &extra_data_size, NULL))
2006
			return ARCHIVE_EOF;
2034
			return ARCHIVE_EOF;
2007
	} else {
2035
	} else {
2008
		extra_data_size = 0;
2036
		extra_data_size = 0;
Lines 2229-2238 static int process_base_block(struct archive_read* a, Link Here
2229
	/* Verify the CRC32 of the header data. */
2257
	/* Verify the CRC32 of the header data. */
2230
	computed_crc = (uint32_t) crc32(0, p, (int) hdr_size);
2258
	computed_crc = (uint32_t) crc32(0, p, (int) hdr_size);
2231
	if(computed_crc != hdr_crc) {
2259
	if(computed_crc != hdr_crc) {
2260
#ifndef DONT_FAIL_ON_CRC_ERROR
2232
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2261
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2233
		    "Header CRC error");
2262
		    "Header CRC error");
2234
2263
2235
		return ARCHIVE_FATAL;
2264
		return ARCHIVE_FATAL;
2265
#endif
2236
	}
2266
	}
2237
2267
2238
	/* If the checksum is OK, we proceed with parsing. */
2268
	/* If the checksum is OK, we proceed with parsing. */
Lines 2271-2276 static int process_base_block(struct archive_read* a, Link Here
2271
			ret = process_head_file(a, rar, entry, header_flags);
2301
			ret = process_head_file(a, rar, entry, header_flags);
2272
			return ret;
2302
			return ret;
2273
		case HEAD_CRYPT:
2303
		case HEAD_CRYPT:
2304
			archive_entry_set_is_metadata_encrypted(entry, 1);
2305
			archive_entry_set_is_data_encrypted(entry, 1);
2306
			rar->has_encrypted_entries = 1;
2307
			rar->headers_are_encrypted = 1;
2274
			archive_set_error(&a->archive,
2308
			archive_set_error(&a->archive,
2275
			    ARCHIVE_ERRNO_FILE_FORMAT,
2309
			    ARCHIVE_ERRNO_FILE_FORMAT,
2276
			    "Encryption is not supported");
2310
			    "Encryption is not supported");
Lines 2415-2420 static int rar5_read_header(struct archive_read *a, Link Here
2415
	struct rar5* rar = get_context(a);
2449
	struct rar5* rar = get_context(a);
2416
	int ret;
2450
	int ret;
2417
2451
2452
	/*
2453
	 * It should be sufficient to call archive_read_next_header() for
2454
	 * a reader to determine if an entry is encrypted or not.
2455
	 */
2456
	if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
2457
		rar->has_encrypted_entries = 0;
2458
	}
2459
2418
	if(rar->header_initialized == 0) {
2460
	if(rar->header_initialized == 0) {
2419
		init_header(a);
2461
		init_header(a);
2420
		if ((ret = try_skip_sfx(a)) < ARCHIVE_WARN)
2462
		if ((ret = try_skip_sfx(a)) < ARCHIVE_WARN)
Lines 2453-2458 static void init_unpack(struct rar5* rar) { Link Here
2453
		rar->cstate.filtered_buf = NULL;
2495
		rar->cstate.filtered_buf = NULL;
2454
	}
2496
	}
2455
2497
2498
	clear_data_ready_stack(rar);
2499
2456
	rar->cstate.write_ptr = 0;
2500
	rar->cstate.write_ptr = 0;
2457
	rar->cstate.last_write_ptr = 0;
2501
	rar->cstate.last_write_ptr = 0;
2458
2502
Lines 2983-2989 static int decode_code_length(struct archive_read* a, struct rar5* rar, Link Here
2983
3027
2984
static int copy_string(struct archive_read* a, int len, int dist) {
3028
static int copy_string(struct archive_read* a, int len, int dist) {
2985
	struct rar5* rar = get_context(a);
3029
	struct rar5* rar = get_context(a);
2986
	const uint64_t cmask = rar->cstate.window_mask;
3030
	const ssize_t cmask = rar->cstate.window_mask;
2987
	const uint64_t write_ptr = rar->cstate.write_ptr +
3031
	const uint64_t write_ptr = rar->cstate.write_ptr +
2988
	    rar->cstate.solid_offset;
3032
	    rar->cstate.solid_offset;
2989
	int i;
3033
	int i;
Lines 3627-3632 static int use_data(struct rar5* rar, const void** buf, size_t* size, Link Here
3627
	return ARCHIVE_RETRY;
3671
	return ARCHIVE_RETRY;
3628
}
3672
}
3629
3673
3674
static void clear_data_ready_stack(struct rar5* rar) {
3675
	memset(&rar->cstate.dready, 0, sizeof(rar->cstate.dready));
3676
}
3677
3630
/* Pushes the `buf`, `size` and `offset` arguments to the rar->cstate.dready
3678
/* Pushes the `buf`, `size` and `offset` arguments to the rar->cstate.dready
3631
 * FIFO stack. Those values will be popped from this stack by the `use_data`
3679
 * FIFO stack. Those values will be popped from this stack by the `use_data`
3632
 * function. */
3680
 * function. */
Lines 4069-4074 static int rar5_read_data(struct archive_read *a, const void **buff, Link Here
4069
	if (size)
4117
	if (size)
4070
		*size = 0;
4118
		*size = 0;
4071
4119
4120
	if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) {
4121
		rar->has_encrypted_entries = 0;
4122
	}
4123
4124
	if (rar->headers_are_encrypted || rar->cstate.data_encrypted) {
4125
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
4126
		    "Reading encrypted data is not currently supported");
4127
		return ARCHIVE_FATAL;
4128
	}
4129
4072
	if(rar->file.dir > 0) {
4130
	if(rar->file.dir > 0) {
4073
		/* Don't process any data if this file entry was declared
4131
		/* Don't process any data if this file entry was declared
4074
		 * as a directory. This is needed, because entries marked as
4132
		 * as a directory. This is needed, because entries marked as
Lines 4120-4130 static int rar5_read_data(struct archive_read *a, const void **buff, Link Here
4120
static int rar5_read_data_skip(struct archive_read *a) {
4178
static int rar5_read_data_skip(struct archive_read *a) {
4121
	struct rar5* rar = get_context(a);
4179
	struct rar5* rar = get_context(a);
4122
4180
4123
	if(rar->main.solid) {
4181
	if(rar->main.solid && (rar->cstate.data_encrypted == 0)) {
4124
		/* In solid archives, instead of skipping the data, we need to
4182
		/* In solid archives, instead of skipping the data, we need to
4125
		 * extract it, and dispose the result. The side effect of this
4183
		 * extract it, and dispose the result. The side effect of this
4126
		 * operation will be setting up the initial window buffer state
4184
		 * operation will be setting up the initial window buffer state
4127
		 * needed to be able to extract the selected file. */
4185
		 * needed to be able to extract the selected file. Note that
4186
		 * this is only possible when data withing this solid block is
4187
		 * not encrypted, in which case we'll skip and fail if the user
4188
		 * tries to read data. */
4128
4189
4129
		int ret;
4190
		int ret;
4130
4191
Lines 4185-4190 static int rar5_cleanup(struct archive_read *a) { Link Here
4185
4246
4186
	free(rar->cstate.window_buf);
4247
	free(rar->cstate.window_buf);
4187
	free(rar->cstate.filtered_buf);
4248
	free(rar->cstate.filtered_buf);
4249
	clear_data_ready_stack(rar);
4188
4250
4189
	free(rar->vol.push_buf);
4251
	free(rar->vol.push_buf);
4190
4252
Lines 4199-4212 static int rar5_cleanup(struct archive_read *a) { Link Here
4199
4261
4200
static int rar5_capabilities(struct archive_read * a) {
4262
static int rar5_capabilities(struct archive_read * a) {
4201
	(void) a;
4263
	(void) a;
4202
	return 0;
4264
	return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA
4265
			| ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA);
4203
}
4266
}
4204
4267
4205
static int rar5_has_encrypted_entries(struct archive_read *_a) {
4268
static int rar5_has_encrypted_entries(struct archive_read *_a) {
4206
	(void) _a;
4269
	if (_a && _a->format) {
4270
		struct rar5 *rar = (struct rar5 *)_a->format->data;
4271
		if (rar) {
4272
			return rar->has_encrypted_entries;
4273
		}
4274
	}
4207
4275
4208
	/* Unsupported for now. */
4276
	return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
4209
	return ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED;
4210
}
4277
}
4211
4278
4212
static int rar5_init(struct rar5* rar) {
4279
static int rar5_init(struct rar5* rar) {
Lines 4215-4220 static int rar5_init(struct rar5* rar) { Link Here
4215
	if(CDE_OK != cdeque_init(&rar->cstate.filters, 8192))
4282
	if(CDE_OK != cdeque_init(&rar->cstate.filters, 8192))
4216
		return ARCHIVE_FATAL;
4283
		return ARCHIVE_FATAL;
4217
4284
4285
	/*
4286
	 * Until enough data has been read, we cannot tell about
4287
	 * any encrypted entries yet.
4288
	 */
4289
	rar->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW;
4290
4218
	return ARCHIVE_OK;
4291
	return ARCHIVE_OK;
4219
}
4292
}
4220
4293
(-)b/contrib/libarchive/libarchive/archive_read_support_format_raw.c (-1 / +1 lines)
Lines 61-67 archive_read_support_format_raw(struct archive *_a) Link Here
61
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
61
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
62
	    ARCHIVE_STATE_NEW, "archive_read_support_format_raw");
62
	    ARCHIVE_STATE_NEW, "archive_read_support_format_raw");
63
63
64
	info = (struct raw_info *)calloc(1, sizeof(*info));
64
	info = calloc(1, sizeof(*info));
65
	if (info == NULL) {
65
	if (info == NULL) {
66
		archive_set_error(&a->archive, ENOMEM,
66
		archive_set_error(&a->archive, ENOMEM,
67
		    "Can't allocate raw_info data");
67
		    "Can't allocate raw_info data");
(-)b/contrib/libarchive/libarchive/archive_read_support_format_tar.c (-785 / +1436 lines)
Lines 1-5 Link Here
1
/*-
1
/*-
2
 * Copyright (c) 2003-2007 Tim Kientzle
2
 * Copyright (c) 2003-2023 Tim Kientzle
3
 * Copyright (c) 2011-2012 Michihiro NAKAJIMA
3
 * Copyright (c) 2011-2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2016 Martin Matuska
4
 * Copyright (c) 2016 Martin Matuska
5
 * All rights reserved.
5
 * All rights reserved.
Lines 117-149 struct sparse_block { Link Here
117
};
117
};
118
118
119
struct tar {
119
struct tar {
120
	struct archive_string	 acl_text;
121
	struct archive_string	 entry_pathname;
120
	struct archive_string	 entry_pathname;
122
	/* For "GNU.sparse.name" and other similar path extensions. */
121
	/* For "GNU.sparse.name" and other similar path extensions. */
123
	struct archive_string	 entry_pathname_override;
122
	struct archive_string	 entry_pathname_override;
124
	struct archive_string	 entry_linkpath;
125
	struct archive_string	 entry_uname;
123
	struct archive_string	 entry_uname;
126
	struct archive_string	 entry_gname;
124
	struct archive_string	 entry_gname;
127
	struct archive_string	 longlink;
125
	struct archive_string	 entry_linkpath;
128
	struct archive_string	 longname;
129
	struct archive_string	 pax_header;
130
	struct archive_string	 pax_global;
131
	struct archive_string	 line;
126
	struct archive_string	 line;
132
	int			 pax_hdrcharset_binary;
127
	int			 pax_hdrcharset_utf8;
133
	int			 header_recursion_depth;
134
	int64_t			 entry_bytes_remaining;
128
	int64_t			 entry_bytes_remaining;
135
	int64_t			 entry_offset;
129
	int64_t			 entry_offset;
136
	int64_t			 entry_padding;
130
	int64_t			 entry_padding;
137
	int64_t 		 entry_bytes_unconsumed;
131
	int64_t 		 entry_bytes_unconsumed;
138
	int64_t			 realsize;
132
	int64_t			 realsize;
139
	int			 sparse_allowed;
140
	struct sparse_block	*sparse_list;
133
	struct sparse_block	*sparse_list;
141
	struct sparse_block	*sparse_last;
134
	struct sparse_block	*sparse_last;
142
	int64_t			 sparse_offset;
135
	int64_t			 sparse_offset;
143
	int64_t			 sparse_numbytes;
136
	int64_t			 sparse_numbytes;
144
	int			 sparse_gnu_major;
137
	int			 sparse_gnu_major;
145
	int			 sparse_gnu_minor;
138
	int			 sparse_gnu_minor;
146
	char			 sparse_gnu_pending;
139
	char			 sparse_gnu_attributes_seen;
140
	char			 filetype;
147
141
148
	struct archive_string	 localname;
142
	struct archive_string	 localname;
149
	struct archive_string_conv *opt_sconv;
143
	struct archive_string_conv *opt_sconv;
Lines 168-192 static int gnu_sparse_old_read(struct archive_read *, struct tar *, Link Here
168
static int	gnu_sparse_old_parse(struct archive_read *, struct tar *,
162
static int	gnu_sparse_old_parse(struct archive_read *, struct tar *,
169
		    const struct gnu_sparse *sparse, int length);
163
		    const struct gnu_sparse *sparse, int length);
170
static int	gnu_sparse_01_parse(struct archive_read *, struct tar *,
164
static int	gnu_sparse_01_parse(struct archive_read *, struct tar *,
171
		    const char *);
165
		    const char *, size_t);
172
static ssize_t	gnu_sparse_10_read(struct archive_read *, struct tar *,
166
static ssize_t	gnu_sparse_10_read(struct archive_read *, struct tar *,
173
			size_t *);
167
		    size_t *);
174
static int	header_Solaris_ACL(struct archive_read *,  struct tar *,
168
static int	header_Solaris_ACL(struct archive_read *,  struct tar *,
175
		    struct archive_entry *, const void *, size_t *);
169
		    struct archive_entry *, const void *, size_t *);
176
static int	header_common(struct archive_read *,  struct tar *,
170
static int	header_common(struct archive_read *,  struct tar *,
177
		    struct archive_entry *, const void *);
171
		    struct archive_entry *, const void *);
178
static int	header_old_tar(struct archive_read *, struct tar *,
172
static int	header_old_tar(struct archive_read *, struct tar *,
179
		    struct archive_entry *, const void *);
173
		    struct archive_entry *, const void *);
180
static int	header_pax_extensions(struct archive_read *, struct tar *,
174
static int	header_pax_extension(struct archive_read *, struct tar *,
181
		    struct archive_entry *, const void *, size_t *);
175
		    struct archive_entry *, const void *, size_t *);
182
static int	header_pax_global(struct archive_read *, struct tar *,
176
static int	header_pax_global(struct archive_read *, struct tar *,
183
		    struct archive_entry *, const void *h, size_t *);
177
		    struct archive_entry *, const void *h, size_t *);
184
static int	header_longlink(struct archive_read *, struct tar *,
178
static int	header_gnu_longlink(struct archive_read *, struct tar *,
185
		    struct archive_entry *, const void *h, size_t *);
186
static int	header_longname(struct archive_read *, struct tar *,
187
		    struct archive_entry *, const void *h, size_t *);
179
		    struct archive_entry *, const void *h, size_t *);
188
static int	read_mac_metadata_blob(struct archive_read *, struct tar *,
180
static int	header_gnu_longname(struct archive_read *, struct tar *,
189
		    struct archive_entry *, const void *h, size_t *);
181
		    struct archive_entry *, const void *h, size_t *);
182
static int	is_mac_metadata_entry(struct archive_entry *entry);
183
static int	read_mac_metadata_blob(struct archive_read *,
184
		    struct archive_entry *, size_t *);
190
static int	header_volume(struct archive_read *, struct tar *,
185
static int	header_volume(struct archive_read *, struct tar *,
191
		    struct archive_entry *, const void *h, size_t *);
186
		    struct archive_entry *, const void *h, size_t *);
192
static int	header_ustar(struct archive_read *, struct tar *,
187
static int	header_ustar(struct archive_read *, struct tar *,
Lines 204-224 static int archive_read_format_tar_read_header(struct archive_read *, Link Here
204
		    struct archive_entry *);
199
		    struct archive_entry *);
205
static int	checksum(struct archive_read *, const void *);
200
static int	checksum(struct archive_read *, const void *);
206
static int 	pax_attribute(struct archive_read *, struct tar *,
201
static int 	pax_attribute(struct archive_read *, struct tar *,
207
		    struct archive_entry *, const char *key, const char *value,
202
		    struct archive_entry *, const char *key, size_t key_length,
208
		    size_t value_length);
203
		    size_t value_length, size_t *unconsumed);
209
static int	pax_attribute_acl(struct archive_read *, struct tar *,
204
static int	pax_attribute_LIBARCHIVE_xattr(struct archive_entry *,
210
		    struct archive_entry *, const char *, int);
205
		    const char *, size_t, const char *, size_t);
211
static int	pax_attribute_xattr(struct archive_entry *, const char *,
206
static int	pax_attribute_SCHILY_acl(struct archive_read *, struct tar *,
212
		    const char *);
207
		    struct archive_entry *, size_t, int);
213
static int 	pax_header(struct archive_read *, struct tar *,
208
static int	pax_attribute_SUN_holesdata(struct archive_read *, struct tar *,
214
		    struct archive_entry *, struct archive_string *);
209
		    struct archive_entry *, const char *, size_t);
215
static void	pax_time(const char *, int64_t *sec, long *nanos);
210
static void	pax_time(const char *, size_t, int64_t *sec, long *nanos);
216
static ssize_t	readline(struct archive_read *, struct tar *, const char **,
211
static ssize_t	readline(struct archive_read *, struct tar *, const char **,
217
		    ssize_t limit, size_t *);
212
		    ssize_t limit, size_t *);
218
static int	read_body_to_string(struct archive_read *, struct tar *,
213
static int	read_body_to_string(struct archive_read *, struct tar *,
219
		    struct archive_string *, const void *h, size_t *);
214
		    struct archive_string *, const void *h, size_t *);
220
static int	solaris_sparse_parse(struct archive_read *, struct tar *,
215
static int	read_bytes_to_string(struct archive_read *,
221
		    struct archive_entry *, const char *);
216
		    struct archive_string *, size_t, size_t *);
222
static int64_t	tar_atol(const char *, size_t);
217
static int64_t	tar_atol(const char *, size_t);
223
static int64_t	tar_atol10(const char *, size_t);
218
static int64_t	tar_atol10(const char *, size_t);
224
static int64_t	tar_atol256(const char *, size_t);
219
static int64_t	tar_atol256(const char *, size_t);
Lines 226-234 static int64_t tar_atol8(const char *, size_t); Link Here
226
static int	tar_read_header(struct archive_read *, struct tar *,
221
static int	tar_read_header(struct archive_read *, struct tar *,
227
		    struct archive_entry *, size_t *);
222
		    struct archive_entry *, size_t *);
228
static int	tohex(int c);
223
static int	tohex(int c);
229
static char	*url_decode(const char *);
224
static char	*url_decode(const char *, size_t);
230
static void	tar_flush_unconsumed(struct archive_read *, size_t *);
225
static void	tar_flush_unconsumed(struct archive_read *, size_t *);
231
226
227
/* Sanity limits:  These numbers should be low enough to
228
 * prevent a maliciously-crafted archive from forcing us to
229
 * allocate extreme amounts of memory.  But of course, they
230
 * need to be high enough for any correct value.  These
231
 * will likely need some adjustment as we get more experience. */
232
static const size_t guname_limit = 65536; /* Longest uname or gname: 64kiB */
233
static const size_t pathname_limit = 1048576; /* Longest path name: 1MiB */
234
static const size_t sparse_map_limit = 8 * 1048576; /* Longest sparse map: 8MiB */
235
static const size_t xattr_limit = 16 * 1048576; /* Longest xattr: 16MiB */
236
static const size_t fflags_limit = 512; /* Longest fflags */
237
static const size_t acl_limit = 131072; /* Longest textual ACL: 128kiB */
238
static const int64_t entry_limit = 0xfffffffffffffffLL; /* 2^60 bytes = 1 ExbiByte */
232
239
233
int
240
int
234
archive_read_support_format_gnutar(struct archive *a)
241
archive_read_support_format_gnutar(struct archive *a)
Lines 249-255 archive_read_support_format_tar(struct archive *_a) Link Here
249
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
256
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
250
	    ARCHIVE_STATE_NEW, "archive_read_support_format_tar");
257
	    ARCHIVE_STATE_NEW, "archive_read_support_format_tar");
251
258
252
	tar = (struct tar *)calloc(1, sizeof(*tar));
259
	tar = calloc(1, sizeof(*tar));
253
	if (tar == NULL) {
260
	if (tar == NULL) {
254
		archive_set_error(&a->archive, ENOMEM,
261
		archive_set_error(&a->archive, ENOMEM,
255
		    "Can't allocate tar data");
262
		    "Can't allocate tar data");
Lines 283-299 archive_read_format_tar_cleanup(struct archive_read *a) Link Here
283
290
284
	tar = (struct tar *)(a->format->data);
291
	tar = (struct tar *)(a->format->data);
285
	gnu_clear_sparse_list(tar);
292
	gnu_clear_sparse_list(tar);
286
	archive_string_free(&tar->acl_text);
287
	archive_string_free(&tar->entry_pathname);
293
	archive_string_free(&tar->entry_pathname);
288
	archive_string_free(&tar->entry_pathname_override);
294
	archive_string_free(&tar->entry_pathname_override);
289
	archive_string_free(&tar->entry_linkpath);
290
	archive_string_free(&tar->entry_uname);
295
	archive_string_free(&tar->entry_uname);
291
	archive_string_free(&tar->entry_gname);
296
	archive_string_free(&tar->entry_gname);
297
	archive_string_free(&tar->entry_linkpath);
292
	archive_string_free(&tar->line);
298
	archive_string_free(&tar->line);
293
	archive_string_free(&tar->pax_global);
294
	archive_string_free(&tar->pax_header);
295
	archive_string_free(&tar->longname);
296
	archive_string_free(&tar->longlink);
297
	archive_string_free(&tar->localname);
299
	archive_string_free(&tar->localname);
298
	free(tar);
300
	free(tar);
299
	(a->format->data) = NULL;
301
	(a->format->data) = NULL;
Lines 505-510 archive_read_format_tar_read_header(struct archive_read *a, Link Here
505
	 * probably not worthwhile just to support the relatively
507
	 * probably not worthwhile just to support the relatively
506
	 * obscure tar->cpio conversion case.
508
	 * obscure tar->cpio conversion case.
507
	 */
509
	 */
510
	/* TODO: Move this into `struct tar` to avoid conflicts
511
	 * when reading multiple archives */
508
	static int default_inode;
512
	static int default_inode;
509
	static int default_dev;
513
	static int default_dev;
510
	struct tar *tar;
514
	struct tar *tar;
Lines 623-633 archive_read_format_tar_read_data(struct archive_read *a, Link Here
623
		}
627
		}
624
628
625
		*buff = __archive_read_ahead(a, 1, &bytes_read);
629
		*buff = __archive_read_ahead(a, 1, &bytes_read);
626
		if (bytes_read < 0)
627
			return (ARCHIVE_FATAL);
628
		if (*buff == NULL) {
630
		if (*buff == NULL) {
629
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
631
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
630
			    "Truncated tar archive");
632
			    "Truncated tar archive"
633
			    " detected while reading data");
631
			return (ARCHIVE_FATAL);
634
			return (ARCHIVE_FATAL);
632
		}
635
		}
633
		if (bytes_read > tar->entry_bytes_remaining)
636
		if (bytes_read > tar->entry_bytes_remaining)
Lines 688-694 archive_read_format_tar_skip(struct archive_read *a) Link Here
688
}
691
}
689
692
690
/*
693
/*
691
 * This function recursively interprets all of the headers associated
694
 * This function reads and interprets all of the headers associated
692
 * with a single entry.
695
 * with a single entry.
693
 */
696
 */
694
static int
697
static int
Lines 696-885 tar_read_header(struct archive_read *a, struct tar *tar, Link Here
696
    struct archive_entry *entry, size_t *unconsumed)
699
    struct archive_entry *entry, size_t *unconsumed)
697
{
700
{
698
	ssize_t bytes;
701
	ssize_t bytes;
699
	int err, eof_vol_header;
702
	int err = ARCHIVE_OK, err2;
703
	int eof_fatal = 0; /* EOF is okay at some points... */
700
	const char *h;
704
	const char *h;
701
	const struct archive_entry_header_ustar *header;
705
	const struct archive_entry_header_ustar *header;
702
	const struct archive_entry_header_gnutar *gnuheader;
706
	const struct archive_entry_header_gnutar *gnuheader;
703
707
704
	eof_vol_header = 0;
708
	/* Bitmask of what header types we've seen. */
705
709
	int32_t seen_headers = 0;
706
	/* Loop until we find a workable header record. */
710
	static const int32_t seen_A_header = 1;
707
	for (;;) {
711
	static const int32_t seen_g_header = 2;
708
		tar_flush_unconsumed(a, unconsumed);
712
	static const int32_t seen_K_header = 4;
713
	static const int32_t seen_L_header = 8;
714
	static const int32_t seen_V_header = 16;
715
	static const int32_t seen_x_header = 32; /* Also X */
716
	static const int32_t seen_mac_metadata = 512;
717
718
	tar->pax_hdrcharset_utf8 = 1;
719
	tar->sparse_gnu_attributes_seen = 0;
720
	archive_string_empty(&(tar->entry_gname));
721
	archive_string_empty(&(tar->entry_pathname));
722
	archive_string_empty(&(tar->entry_pathname_override));
723
	archive_string_empty(&(tar->entry_uname));
724
	archive_string_empty(&tar->entry_linkpath);
709
725
710
		/* Read 512-byte header record */
726
	/* Ensure format is set. */
711
		h = __archive_read_ahead(a, 512, &bytes);
727
	if (a->archive.archive_format_name == NULL) {
712
		if (bytes < 0)
728
		a->archive.archive_format = ARCHIVE_FORMAT_TAR;
713
			return ((int)bytes);
729
		a->archive.archive_format_name = "tar";
714
		if (bytes == 0) { /* EOF at a block boundary. */
730
	}
715
			/* Some writers do omit the block of nulls. <sigh> */
716
			return (ARCHIVE_EOF);
717
		}
718
		if (bytes < 512) {  /* Short block at EOF; this is bad. */
719
			archive_set_error(&a->archive,
720
			    ARCHIVE_ERRNO_FILE_FORMAT,
721
			    "Truncated tar archive");
722
			return (ARCHIVE_FATAL);
723
		}
724
		*unconsumed = 512;
725
731
726
		/* Header is workable if it's not an end-of-archive mark. */
732
	/*
727
		if (h[0] != 0 || !archive_block_is_null(h))
733
	 * TODO: Write global/default pax options into
728
			break;
734
	 * 'entry' struct here before overwriting with
735
	 * file-specific options.
736
	 */
729
737
730
		/* Ensure format is set for archives with only null blocks. */
738
	/* Loop over all the headers needed for the next entry */
731
		if (a->archive.archive_format_name == NULL) {
739
	for (;;) {
732
			a->archive.archive_format = ARCHIVE_FORMAT_TAR;
733
			a->archive.archive_format_name = "tar";
734
		}
735
740
736
		if (!tar->read_concatenated_archives) {
741
		/* Find the next valid header record. */
737
			/* Try to consume a second all-null record, as well. */
742
		while (1) {
738
			tar_flush_unconsumed(a, unconsumed);
743
			tar_flush_unconsumed(a, unconsumed);
739
			h = __archive_read_ahead(a, 512, NULL);
740
			if (h != NULL && h[0] == 0 && archive_block_is_null(h))
741
				__archive_read_consume(a, 512);
742
			archive_clear_error(&a->archive);
743
			return (ARCHIVE_EOF);
744
		}
745
744
746
		/*
745
			/* Read 512-byte header record */
747
		 * We're reading concatenated archives, ignore this block and
746
			h = __archive_read_ahead(a, 512, &bytes);
748
		 * loop to get the next.
747
			if (bytes == 0) { /* EOF at a block boundary. */
749
		 */
748
				if (eof_fatal) {
750
	}
749
					/* We've read a special header already;
750
					 * if there's no regular header, then this is
751
					 * a premature EOF. */
752
					archive_set_error(&a->archive, EINVAL,
753
							  "Damaged tar archive");
754
					return (ARCHIVE_FATAL);
755
				} else {
756
					return (ARCHIVE_EOF);
757
				}
758
			}
759
			if (h == NULL) {  /* Short block at EOF; this is bad. */
760
				archive_set_error(&a->archive,
761
				    ARCHIVE_ERRNO_FILE_FORMAT,
762
				    "Truncated tar archive"
763
				    " detected while reading next heaader");
764
				return (ARCHIVE_FATAL);
765
			}
766
			*unconsumed += 512;
751
767
752
	/*
768
			if (h[0] == 0 && archive_block_is_null(h)) {
753
	 * Note: If the checksum fails and we return ARCHIVE_RETRY,
769
				/* We found a NULL block which indicates end-of-archive */
754
	 * then the client is likely to just retry.  This is a very
755
	 * crude way to search for the next valid header!
756
	 *
757
	 * TODO: Improve this by implementing a real header scan.
758
	 */
759
	if (!checksum(a, h)) {
760
		tar_flush_unconsumed(a, unconsumed);
761
		archive_set_error(&a->archive, EINVAL, "Damaged tar archive");
762
		return (ARCHIVE_RETRY); /* Retryable: Invalid header */
763
	}
764
770
765
	if (++tar->header_recursion_depth > 32) {
771
				if (tar->read_concatenated_archives) {
766
		tar_flush_unconsumed(a, unconsumed);
772
					/* We're ignoring NULL blocks, so keep going. */
767
		archive_set_error(&a->archive, EINVAL, "Too many special headers");
773
					continue;
768
		return (ARCHIVE_WARN);
774
				}
769
	}
770
775
771
	/* Determine the format variant. */
776
				/* Try to consume a second all-null record, as well. */
772
	header = (const struct archive_entry_header_ustar *)h;
777
				/* If we can't, that's okay. */
778
				tar_flush_unconsumed(a, unconsumed);
779
				h = __archive_read_ahead(a, 512, NULL);
780
				if (h != NULL && h[0] == 0 && archive_block_is_null(h))
781
						__archive_read_consume(a, 512);
773
782
774
	switch(header->typeflag[0]) {
783
				archive_clear_error(&a->archive);
775
	case 'A': /* Solaris tar ACL */
784
				return (ARCHIVE_EOF);
776
		a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
777
		a->archive.archive_format_name = "Solaris tar";
778
		err = header_Solaris_ACL(a, tar, entry, h, unconsumed);
779
		break;
780
	case 'g': /* POSIX-standard 'g' header. */
781
		a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
782
		a->archive.archive_format_name = "POSIX pax interchange format";
783
		err = header_pax_global(a, tar, entry, h, unconsumed);
784
		if (err == ARCHIVE_EOF)
785
			return (err);
786
		break;
787
	case 'K': /* Long link name (GNU tar, others) */
788
		err = header_longlink(a, tar, entry, h, unconsumed);
789
		break;
790
	case 'L': /* Long filename (GNU tar, others) */
791
		err = header_longname(a, tar, entry, h, unconsumed);
792
		break;
793
	case 'V': /* GNU volume header */
794
		err = header_volume(a, tar, entry, h, unconsumed);
795
		if (err == ARCHIVE_EOF)
796
			eof_vol_header = 1;
797
		break;
798
	case 'X': /* Used by SUN tar; same as 'x'. */
799
		a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
800
		a->archive.archive_format_name =
801
		    "POSIX pax interchange format (Sun variant)";
802
		err = header_pax_extensions(a, tar, entry, h, unconsumed);
803
		break;
804
	case 'x': /* POSIX-standard 'x' header. */
805
		a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
806
		a->archive.archive_format_name = "POSIX pax interchange format";
807
		err = header_pax_extensions(a, tar, entry, h, unconsumed);
808
		break;
809
	default:
810
		gnuheader = (const struct archive_entry_header_gnutar *)h;
811
		if (memcmp(gnuheader->magic, "ustar  \0", 8) == 0) {
812
			a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
813
			a->archive.archive_format_name = "GNU tar format";
814
			err = header_gnutar(a, tar, entry, h, unconsumed);
815
		} else if (memcmp(header->magic, "ustar", 5) == 0) {
816
			if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
817
				a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR;
818
				a->archive.archive_format_name = "POSIX ustar format";
819
			}
785
			}
820
			err = header_ustar(a, tar, entry, h);
821
		} else {
822
			a->archive.archive_format = ARCHIVE_FORMAT_TAR;
823
			a->archive.archive_format_name = "tar (non-POSIX)";
824
			err = header_old_tar(a, tar, entry, h);
825
		}
826
	}
827
	if (err == ARCHIVE_FATAL)
828
		return (err);
829
830
	tar_flush_unconsumed(a, unconsumed);
831
786
832
	h = NULL;
787
			/* This is NOT a null block, so it must be a valid header. */
833
	header = NULL;
788
			if (!checksum(a, h)) {
789
				tar_flush_unconsumed(a, unconsumed);
790
				archive_set_error(&a->archive, EINVAL, "Damaged tar archive");
791
				/* If we've read some critical information (pax headers, etc)
792
				 * and _then_ see a bad header, we can't really recover. */
793
				if (eof_fatal) {
794
					return (ARCHIVE_FATAL);
795
				} else {
796
					return (ARCHIVE_RETRY);
797
				}
798
			}
799
			break;
800
		}
834
801
835
	--tar->header_recursion_depth;
802
		/* Determine the format variant. */
836
	/* Yuck.  Apple's design here ends up storing long pathname
803
		header = (const struct archive_entry_header_ustar *)h;
837
	 * extensions for both the AppleDouble extension entry and the
804
		switch(header->typeflag[0]) {
838
	 * regular entry.
805
		case 'A': /* Solaris tar ACL */
839
	 */
806
			if (seen_headers & seen_A_header) {
840
	if ((err == ARCHIVE_WARN || err == ARCHIVE_OK) &&
807
				return (ARCHIVE_FATAL);
841
	    tar->header_recursion_depth == 0 &&
808
			}
842
	    tar->process_mac_extensions) {
809
			seen_headers |= seen_A_header;
843
		int err2 = read_mac_metadata_blob(a, tar, entry, h, unconsumed);
810
			a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
844
		if (err2 < err)
811
			a->archive.archive_format_name = "Solaris tar";
845
			err = err2;
812
			err2 = header_Solaris_ACL(a, tar, entry, h, unconsumed);
846
	}
813
			break;
847
814
		case 'g': /* POSIX-standard 'g' header. */
848
	/* We return warnings or success as-is.  Anything else is fatal. */
815
			if (seen_headers & seen_g_header) {
849
	if (err == ARCHIVE_WARN || err == ARCHIVE_OK) {
816
				return (ARCHIVE_FATAL);
850
		if (tar->sparse_gnu_pending) {
817
			}
851
			if (tar->sparse_gnu_major == 1 &&
818
			seen_headers |= seen_g_header;
852
			    tar->sparse_gnu_minor == 0) {
819
			a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
853
				ssize_t bytes_read;
820
			a->archive.archive_format_name = "POSIX pax interchange format";
854
821
			err2 = header_pax_global(a, tar, entry, h, unconsumed);
855
				tar->sparse_gnu_pending = 0;
822
			break;
856
				/* Read initial sparse map. */
823
		case 'K': /* Long link name (GNU tar, others) */
857
				bytes_read = gnu_sparse_10_read(a, tar, unconsumed);
824
			if (seen_headers & seen_K_header) {
858
				if (bytes_read < 0)
825
				return (ARCHIVE_FATAL);
859
					return ((int)bytes_read);
826
			}
860
				tar->entry_bytes_remaining -= bytes_read;
827
			seen_headers |= seen_K_header;
828
			err2 = header_gnu_longlink(a, tar, entry, h, unconsumed);
829
			break;
830
		case 'L': /* Long filename (GNU tar, others) */
831
			if (seen_headers & seen_L_header) {
832
				return (ARCHIVE_FATAL);
833
			}
834
			seen_headers |= seen_L_header;
835
			err2 = header_gnu_longname(a, tar, entry, h, unconsumed);
836
			break;
837
		case 'V': /* GNU volume header */
838
			if (seen_headers & seen_V_header) {
839
				return (ARCHIVE_FATAL);
840
			}
841
			seen_headers |= seen_V_header;
842
			err2 = header_volume(a, tar, entry, h, unconsumed);
843
			break;
844
		case 'X': /* Used by SUN tar; same as 'x'. */
845
			if (seen_headers & seen_x_header) {
846
				return (ARCHIVE_FATAL);
847
			}
848
			seen_headers |= seen_x_header;
849
			a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
850
			a->archive.archive_format_name =
851
				"POSIX pax interchange format (Sun variant)";
852
			err2 = header_pax_extension(a, tar, entry, h, unconsumed);
853
			break;
854
		case 'x': /* POSIX-standard 'x' header. */
855
			if (seen_headers & seen_x_header) {
856
				return (ARCHIVE_FATAL);
857
			}
858
			seen_headers |= seen_x_header;
859
			a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
860
			a->archive.archive_format_name = "POSIX pax interchange format";
861
			err2 = header_pax_extension(a, tar, entry, h, unconsumed);
862
			break;
863
		default: /* Regular header: Legacy tar, GNU tar, or ustar */
864
			gnuheader = (const struct archive_entry_header_gnutar *)h;
865
			if (memcmp(gnuheader->magic, "ustar  \0", 8) == 0) {
866
				a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
867
				a->archive.archive_format_name = "GNU tar format";
868
				err2 = header_gnutar(a, tar, entry, h, unconsumed);
869
			} else if (memcmp(header->magic, "ustar", 5) == 0) {
870
				if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
871
					a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR;
872
					a->archive.archive_format_name = "POSIX ustar format";
873
				}
874
				err2 = header_ustar(a, tar, entry, h);
861
			} else {
875
			} else {
862
				archive_set_error(&a->archive,
876
				a->archive.archive_format = ARCHIVE_FORMAT_TAR;
863
				    ARCHIVE_ERRNO_MISC,
877
				a->archive.archive_format_name = "tar (non-POSIX)";
864
				    "Unrecognized GNU sparse file format");
878
				err2 = header_old_tar(a, tar, entry, h);
865
				return (ARCHIVE_WARN);
879
			}
880
			err = err_combine(err, err2);
881
			/* We return warnings or success as-is.  Anything else is fatal. */
882
			if (err < ARCHIVE_WARN) {
883
				return (ARCHIVE_FATAL);
884
			}
885
			/* Filename of the form `._filename` is an AppleDouble
886
			 * extension entry.  The body is the macOS metadata blob;
887
			 * this is followed by another entry with the actual
888
			 * regular file data.
889
			 * This design has two drawbacks:
890
			 * = it's brittle; you might just have a file with such a name
891
			 * = it duplicates any long pathname extensions
892
			 *
893
			 * TODO: This probably shouldn't be here at all.  Consider
894
			 * just returning the contents as a regular entry here and
895
			 * then dealing with it when we write data to disk.
896
			 */
897
			if (tar->process_mac_extensions
898
			    && ((seen_headers & seen_mac_metadata) == 0)
899
			    && is_mac_metadata_entry(entry)) {
900
				err2 = read_mac_metadata_blob(a, entry, unconsumed);
901
				if (err2 < ARCHIVE_WARN) {
902
					return (ARCHIVE_FATAL);
903
				}
904
				err = err_combine(err, err2);
905
				/* Note: Other headers can appear again. */
906
				seen_headers = seen_mac_metadata;
907
				break;
908
			}
909
910
			/* Reconcile GNU sparse attributes */
911
			if (tar->sparse_gnu_attributes_seen) {
912
				/* Only 'S' (GNU sparse) and ustar '0' regular files can be sparse */
913
				if (tar->filetype != 'S' && tar->filetype != '0') {
914
					archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
915
							  "Non-regular file cannot be sparse");
916
					return (ARCHIVE_WARN);
917
				} else if (tar->sparse_gnu_major == 0 &&
918
				    tar->sparse_gnu_minor == 0) {
919
					/* Sparse map already parsed from 'x' header */
920
				} else if (tar->sparse_gnu_major == 0 &&
921
				    tar->sparse_gnu_minor == 1) {
922
					/* Sparse map already parsed from 'x' header */
923
				} else if (tar->sparse_gnu_major == 1 &&
924
				    tar->sparse_gnu_minor == 0) {
925
					/* Sparse map is prepended to file contents */
926
					ssize_t bytes_read;
927
					bytes_read = gnu_sparse_10_read(a, tar, unconsumed);
928
					if (bytes_read < 0)
929
						return ((int)bytes_read);
930
					tar->entry_bytes_remaining -= bytes_read;
931
				} else {
932
					archive_set_error(&a->archive,
933
							  ARCHIVE_ERRNO_MISC,
934
							  "Unrecognized GNU sparse file format");
935
					return (ARCHIVE_WARN);
936
				}
866
			}
937
			}
867
			tar->sparse_gnu_pending = 0;
938
			return (err);
868
		}
939
		}
869
		return (err);
940
870
	}
941
		/* We're between headers ... */
871
	if (err == ARCHIVE_EOF) {
942
		err = err_combine(err, err2);
872
		if (!eof_vol_header) {
943
		if (err == ARCHIVE_FATAL)
873
			/* EOF when recursively reading a header is bad. */
944
			return (err);
874
			archive_set_error(&a->archive, EINVAL,
945
875
			    "Damaged tar archive");
946
		/* The GNU volume header and the pax `g` global header
876
		} else {
947
		 * are both allowed to be the only header in an
877
			/* If we encounter just a GNU volume header treat
948
		 * archive.  If we've seen any other header, a
878
			 * this situation as an empty archive */
949
		 * following EOF is fatal. */
879
			return (ARCHIVE_EOF);
950
		if ((seen_headers & ~seen_V_header & ~seen_g_header) != 0) {
951
			eof_fatal = 1;
880
		}
952
		}
881
	}
953
	}
882
	return (ARCHIVE_FATAL);
883
}
954
}
884
955
885
/*
956
/*
Lines 934-940 checksum(struct archive_read *a, const void *h) Link Here
934
	if (sum == check)
1005
	if (sum == check)
935
		return (1);
1006
		return (1);
936
1007
1008
#if DONT_FAIL_ON_CRC_ERROR
1009
	/* Speed up fuzzing by pretending the checksum is always right. */
1010
	return (1);
1011
#else
937
	return (0);
1012
	return (0);
1013
#endif
938
}
1014
}
939
1015
940
/*
1016
/*
Lines 959-983 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
959
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1035
    struct archive_entry *entry, const void *h, size_t *unconsumed)
960
{
1036
{
961
	const struct archive_entry_header_ustar *header;
1037
	const struct archive_entry_header_ustar *header;
1038
	struct archive_string	 acl_text;
962
	size_t size;
1039
	size_t size;
963
	int err, acl_type;
1040
	int err, acl_type;
964
	int64_t type;
1041
	int64_t type;
965
	char *acl, *p;
1042
	char *acl, *p;
966
1043
967
	/*
968
	 * read_body_to_string adds a NUL terminator, but we need a little
969
	 * more to make sure that we don't overrun acl_text later.
970
	 */
971
	header = (const struct archive_entry_header_ustar *)h;
1044
	header = (const struct archive_entry_header_ustar *)h;
972
	size = (size_t)tar_atol(header->size, sizeof(header->size));
1045
	size = (size_t)tar_atol(header->size, sizeof(header->size));
973
	err = read_body_to_string(a, tar, &(tar->acl_text), h, unconsumed);
1046
	archive_string_init(&acl_text);
974
	if (err != ARCHIVE_OK)
1047
	err = read_body_to_string(a, tar, &acl_text, h, unconsumed);
975
		return (err);
1048
	if (err != ARCHIVE_OK) {
976
1049
		archive_string_free(&acl_text);
977
	/* Recursively read next header */
978
	err = tar_read_header(a, tar, entry, unconsumed);
979
	if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
980
		return (err);
1050
		return (err);
1051
	}
981
1052
982
	/* TODO: Examine the first characters to see if this
1053
	/* TODO: Examine the first characters to see if this
983
	 * is an AIX ACL descriptor.  We'll likely never support
1054
	 * is an AIX ACL descriptor.  We'll likely never support
Lines 985-996 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
985
	 * we do see them. */
1056
	 * we do see them. */
986
1057
987
	/* Leading octal number indicates ACL type and number of entries. */
1058
	/* Leading octal number indicates ACL type and number of entries. */
988
	p = acl = tar->acl_text.s;
1059
	p = acl = acl_text.s;
989
	type = 0;
1060
	type = 0;
990
	while (*p != '\0' && p < acl + size) {
1061
	while (*p != '\0' && p < acl + size) {
991
		if (*p < '0' || *p > '7') {
1062
		if (*p < '0' || *p > '7') {
992
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1063
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
993
			    "Malformed Solaris ACL attribute (invalid digit)");
1064
			    "Malformed Solaris ACL attribute (invalid digit)");
1065
			archive_string_free(&acl_text);
994
			return(ARCHIVE_WARN);
1066
			return(ARCHIVE_WARN);
995
		}
1067
		}
996
		type <<= 3;
1068
		type <<= 3;
Lines 998-1003 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
998
		if (type > 077777777) {
1070
		if (type > 077777777) {
999
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1071
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1000
			    "Malformed Solaris ACL attribute (count too large)");
1072
			    "Malformed Solaris ACL attribute (count too large)");
1073
			archive_string_free(&acl_text);
1001
			return (ARCHIVE_WARN);
1074
			return (ARCHIVE_WARN);
1002
		}
1075
		}
1003
		p++;
1076
		p++;
Lines 1015-1020 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
1015
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1088
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1016
		    "Malformed Solaris ACL attribute (unsupported type %o)",
1089
		    "Malformed Solaris ACL attribute (unsupported type %o)",
1017
		    (int)type);
1090
		    (int)type);
1091
		archive_string_free(&acl_text);
1018
		return (ARCHIVE_WARN);
1092
		return (ARCHIVE_WARN);
1019
	}
1093
	}
1020
	p++;
1094
	p++;
Lines 1022-1027 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
1022
	if (p >= acl + size) {
1096
	if (p >= acl + size) {
1023
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1097
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1024
		    "Malformed Solaris ACL attribute (body overflow)");
1098
		    "Malformed Solaris ACL attribute (body overflow)");
1099
		archive_string_free(&acl_text);
1025
		return(ARCHIVE_WARN);
1100
		return(ARCHIVE_WARN);
1026
	}
1101
	}
1027
1102
Lines 1035-1046 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
1035
	if (tar->sconv_acl == NULL) {
1110
	if (tar->sconv_acl == NULL) {
1036
		tar->sconv_acl = archive_string_conversion_from_charset(
1111
		tar->sconv_acl = archive_string_conversion_from_charset(
1037
		    &(a->archive), "UTF-8", 1);
1112
		    &(a->archive), "UTF-8", 1);
1038
		if (tar->sconv_acl == NULL)
1113
		if (tar->sconv_acl == NULL) {
1114
			archive_string_free(&acl_text);
1039
			return (ARCHIVE_FATAL);
1115
			return (ARCHIVE_FATAL);
1116
		}
1040
	}
1117
	}
1041
	archive_strncpy(&(tar->localname), acl, p - acl);
1118
	archive_strncpy(&(tar->localname), acl, p - acl);
1042
	err = archive_acl_from_text_l(archive_entry_acl(entry),
1119
	err = archive_acl_from_text_l(archive_entry_acl(entry),
1043
	    tar->localname.s, acl_type, tar->sconv_acl);
1120
	    tar->localname.s, acl_type, tar->sconv_acl);
1121
	/* Workaround: Force perm_is_set() to be correct */
1122
	/* If this bit were stored in the ACL, this wouldn't be needed */
1123
	archive_entry_set_perm(entry, archive_entry_perm(entry));
1044
	if (err != ARCHIVE_OK) {
1124
	if (err != ARCHIVE_OK) {
1045
		if (errno == ENOMEM) {
1125
		if (errno == ENOMEM) {
1046
			archive_set_error(&a->archive, ENOMEM,
1126
			archive_set_error(&a->archive, ENOMEM,
Lines 1049-1054 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
1049
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1129
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1050
			    "Malformed Solaris ACL attribute (unparsable)");
1130
			    "Malformed Solaris ACL attribute (unparsable)");
1051
	}
1131
	}
1132
	archive_string_free(&acl_text);
1052
	return (err);
1133
	return (err);
1053
}
1134
}
1054
1135
Lines 1056-1075 header_Solaris_ACL(struct archive_read *a, struct tar *tar, Link Here
1056
 * Interpret 'K' long linkname header.
1137
 * Interpret 'K' long linkname header.
1057
 */
1138
 */
1058
static int
1139
static int
1059
header_longlink(struct archive_read *a, struct tar *tar,
1140
header_gnu_longlink(struct archive_read *a, struct tar *tar,
1060
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1141
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1061
{
1142
{
1062
	int err;
1143
	int err;
1063
1144
1064
	err = read_body_to_string(a, tar, &(tar->longlink), h, unconsumed);
1145
	struct archive_string linkpath;
1065
	if (err != ARCHIVE_OK)
1146
	archive_string_init(&linkpath);
1066
		return (err);
1147
	err = read_body_to_string(a, tar, &linkpath, h, unconsumed);
1067
	err = tar_read_header(a, tar, entry, unconsumed);
1148
	archive_entry_set_link(entry, linkpath.s);
1068
	if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
1149
	archive_string_free(&linkpath);
1069
		return (err);
1150
	return (err);
1070
	/* Set symlink if symlink already set, else hardlink. */
1071
	archive_entry_copy_link(entry, tar->longlink.s);
1072
	return (ARCHIVE_OK);
1073
}
1151
}
1074
1152
1075
static int
1153
static int
Lines 1091-1115 set_conversion_failed_error(struct archive_read *a, Link Here
1091
 * Interpret 'L' long filename header.
1169
 * Interpret 'L' long filename header.
1092
 */
1170
 */
1093
static int
1171
static int
1094
header_longname(struct archive_read *a, struct tar *tar,
1172
header_gnu_longname(struct archive_read *a, struct tar *tar,
1095
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1173
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1096
{
1174
{
1097
	int err;
1175
	int err;
1176
	struct archive_string longname;
1098
1177
1099
	err = read_body_to_string(a, tar, &(tar->longname), h, unconsumed);
1178
	archive_string_init(&longname);
1100
	if (err != ARCHIVE_OK)
1179
	err = read_body_to_string(a, tar, &longname, h, unconsumed);
1101
		return (err);
1180
	if (err == ARCHIVE_OK) {
1102
	/* Read and parse "real" header, then override name. */
1181
		if (archive_entry_copy_pathname_l(entry, longname.s,
1103
	err = tar_read_header(a, tar, entry, unconsumed);
1182
		    archive_strlen(&longname), tar->sconv) != 0)
1104
	if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
1183
			err = set_conversion_failed_error(a, tar->sconv, "Pathname");
1105
		return (err);
1184
	}
1106
	if (archive_entry_copy_pathname_l(entry, tar->longname.s,
1185
	archive_string_free(&longname);
1107
	    archive_strlen(&(tar->longname)), tar->sconv) != 0)
1108
		err = set_conversion_failed_error(a, tar->sconv, "Pathname");
1109
	return (err);
1186
	return (err);
1110
}
1187
}
1111
1188
1112
1113
/*
1189
/*
1114
 * Interpret 'V' GNU tar volume header.
1190
 * Interpret 'V' GNU tar volume header.
1115
 */
1191
 */
Lines 1117-1148 static int Link Here
1117
header_volume(struct archive_read *a, struct tar *tar,
1193
header_volume(struct archive_read *a, struct tar *tar,
1118
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1194
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1119
{
1195
{
1120
	(void)h;
1196
	const struct archive_entry_header_ustar *header;
1197
	int64_t size, to_consume;
1198
1199
	(void)a; /* UNUSED */
1200
	(void)tar; /* UNUSED */
1201
	(void)entry; /* UNUSED */
1121
1202
1122
	/* Just skip this and read the next header. */
1203
	header = (const struct archive_entry_header_ustar *)h;
1123
	return (tar_read_header(a, tar, entry, unconsumed));
1204
	size = tar_atol(header->size, sizeof(header->size));
1205
	if (size > (int64_t)pathname_limit) {
1206
		return (ARCHIVE_FATAL);
1207
	}
1208
	to_consume = ((size + 511) & ~511);
1209
	*unconsumed += to_consume;
1210
	return (ARCHIVE_OK);
1124
}
1211
}
1125
1212
1126
/*
1213
/*
1127
 * Read body of an archive entry into an archive_string object.
1214
 * Read the next `size` bytes into the provided string.
1215
 * Null-terminate the string.
1128
 */
1216
 */
1129
static int
1217
static int
1130
read_body_to_string(struct archive_read *a, struct tar *tar,
1218
read_bytes_to_string(struct archive_read *a,
1131
    struct archive_string *as, const void *h, size_t *unconsumed)
1219
		     struct archive_string *as, size_t size,
1132
{
1220
		     size_t *unconsumed) {
1133
	int64_t size;
1134
	const struct archive_entry_header_ustar *header;
1135
	const void *src;
1221
	const void *src;
1136
1222
1137
	(void)tar; /* UNUSED */
1138
	header = (const struct archive_entry_header_ustar *)h;
1139
	size  = tar_atol(header->size, sizeof(header->size));
1140
	if ((size > 1048576) || (size < 0)) {
1141
		archive_set_error(&a->archive, EINVAL,
1142
		    "Special header too large");
1143
		return (ARCHIVE_FATAL);
1144
	}
1145
1146
	/* Fail if we can't make our buffer big enough. */
1223
	/* Fail if we can't make our buffer big enough. */
1147
	if (archive_string_ensure(as, (size_t)size+1) == NULL) {
1224
	if (archive_string_ensure(as, (size_t)size+1) == NULL) {
1148
		archive_set_error(&a->archive, ENOMEM,
1225
		archive_set_error(&a->archive, ENOMEM,
Lines 1153-1170 read_body_to_string(struct archive_read *a, struct tar *tar, Link Here
1153
	tar_flush_unconsumed(a, unconsumed);
1230
	tar_flush_unconsumed(a, unconsumed);
1154
1231
1155
	/* Read the body into the string. */
1232
	/* Read the body into the string. */
1156
	*unconsumed = (size_t)((size + 511) & ~ 511);
1233
	src = __archive_read_ahead(a, size, NULL);
1157
	src = __archive_read_ahead(a, *unconsumed, NULL);
1158
	if (src == NULL) {
1234
	if (src == NULL) {
1235
		archive_set_error(&a->archive, EINVAL,
1236
		    "Truncated archive"
1237
		    " detected while reading metadata");
1159
		*unconsumed = 0;
1238
		*unconsumed = 0;
1160
		return (ARCHIVE_FATAL);
1239
		return (ARCHIVE_FATAL);
1161
	}
1240
	}
1162
	memcpy(as->s, src, (size_t)size);
1241
	memcpy(as->s, src, (size_t)size);
1163
	as->s[size] = '\0';
1242
	as->s[size] = '\0';
1164
	as->length = (size_t)size;
1243
	as->length = (size_t)size;
1244
	*unconsumed += size;
1165
	return (ARCHIVE_OK);
1245
	return (ARCHIVE_OK);
1166
}
1246
}
1167
1247
1248
/*
1249
 * Read body of an archive entry into an archive_string object.
1250
 */
1251
static int
1252
read_body_to_string(struct archive_read *a, struct tar *tar,
1253
    struct archive_string *as, const void *h, size_t *unconsumed)
1254
{
1255
	int64_t size;
1256
	const struct archive_entry_header_ustar *header;
1257
	int r;
1258
1259
	(void)tar; /* UNUSED */
1260
	header = (const struct archive_entry_header_ustar *)h;
1261
	size  = tar_atol(header->size, sizeof(header->size));
1262
	if (size > entry_limit) {
1263
		return (ARCHIVE_FATAL);
1264
	}
1265
	if ((size > (int64_t)pathname_limit) || (size < 0)) {
1266
		archive_string_empty(as);
1267
		int64_t to_consume = ((size + 511) & ~511);
1268
		if (to_consume != __archive_read_consume(a, to_consume)) {
1269
			return (ARCHIVE_FATAL);
1270
		}
1271
		archive_set_error(&a->archive, EINVAL,
1272
		    "Special header too large: %d > 1MiB",
1273
		    (int)size);
1274
		return (ARCHIVE_WARN);
1275
	}
1276
	r = read_bytes_to_string(a, as, size, unconsumed);
1277
	*unconsumed += 0x1ff & (-size);
1278
	return(r);
1279
}
1280
1168
/*
1281
/*
1169
 * Parse out common header elements.
1282
 * Parse out common header elements.
1170
 *
1283
 *
Lines 1180-1200 header_common(struct archive_read *a, struct tar *tar, Link Here
1180
    struct archive_entry *entry, const void *h)
1293
    struct archive_entry *entry, const void *h)
1181
{
1294
{
1182
	const struct archive_entry_header_ustar	*header;
1295
	const struct archive_entry_header_ustar	*header;
1183
	char	tartype;
1296
	const char *existing_linkpath;
1297
	const wchar_t *existing_wcs_linkpath;
1184
	int     err = ARCHIVE_OK;
1298
	int     err = ARCHIVE_OK;
1185
1299
1186
	header = (const struct archive_entry_header_ustar *)h;
1300
	header = (const struct archive_entry_header_ustar *)h;
1187
	if (header->linkname[0])
1188
		archive_strncpy(&(tar->entry_linkpath),
1189
		    header->linkname, sizeof(header->linkname));
1190
	else
1191
		archive_string_empty(&(tar->entry_linkpath));
1192
1301
1193
	/* Parse out the numeric fields (all are octal) */
1302
	/* Parse out the numeric fields (all are octal) */
1194
	archive_entry_set_mode(entry,
1303
1195
		(mode_t)tar_atol(header->mode, sizeof(header->mode)));
1304
	/* Split mode handling: Set filetype always, perm only if not already set */
1196
	archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
1305
	archive_entry_set_filetype(entry,
1197
	archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
1306
	    (mode_t)tar_atol(header->mode, sizeof(header->mode)));
1307
	if (!archive_entry_perm_is_set(entry)) {
1308
		archive_entry_set_perm(entry,
1309
			(mode_t)tar_atol(header->mode, sizeof(header->mode)));
1310
	}
1311
	if (!archive_entry_uid_is_set(entry)) {
1312
		archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
1313
	}
1314
	if (!archive_entry_gid_is_set(entry)) {
1315
		archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
1316
	}
1317
1198
	tar->entry_bytes_remaining = tar_atol(header->size, sizeof(header->size));
1318
	tar->entry_bytes_remaining = tar_atol(header->size, sizeof(header->size));
1199
	if (tar->entry_bytes_remaining < 0) {
1319
	if (tar->entry_bytes_remaining < 0) {
1200
		tar->entry_bytes_remaining = 0;
1320
		tar->entry_bytes_remaining = 0;
Lines 1202-1229 header_common(struct archive_read *a, struct tar *tar, Link Here
1202
		    "Tar entry has negative size");
1322
		    "Tar entry has negative size");
1203
		return (ARCHIVE_FATAL);
1323
		return (ARCHIVE_FATAL);
1204
	}
1324
	}
1205
	if (tar->entry_bytes_remaining == INT64_MAX) {
1325
	if (tar->entry_bytes_remaining > entry_limit) {
1206
		/* Note: tar_atol returns INT64_MAX on overflow */
1207
		tar->entry_bytes_remaining = 0;
1326
		tar->entry_bytes_remaining = 0;
1208
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1327
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1209
		    "Tar entry size overflow");
1328
		    "Tar entry size overflow");
1210
		return (ARCHIVE_FATAL);
1329
		return (ARCHIVE_FATAL);
1211
	}
1330
	}
1212
	tar->realsize = tar->entry_bytes_remaining;
1331
	if (!tar->realsize_override) {
1213
	archive_entry_set_size(entry, tar->entry_bytes_remaining);
1332
		tar->realsize = tar->entry_bytes_remaining;
1214
	archive_entry_set_mtime(entry, tar_atol(header->mtime, sizeof(header->mtime)), 0);
1333
	}
1334
	archive_entry_set_size(entry, tar->realsize);
1335
1336
	if (!archive_entry_mtime_is_set(entry)) {
1337
		archive_entry_set_mtime(entry, tar_atol(header->mtime, sizeof(header->mtime)), 0);
1338
	}
1215
1339
1216
	/* Handle the tar type flag appropriately. */
1340
	/* Handle the tar type flag appropriately. */
1217
	tartype = header->typeflag[0];
1341
	tar->filetype = header->typeflag[0];
1218
1342
1219
	switch (tartype) {
1343
	/*
1344
	 * TODO: If the linkpath came from Pax extension header, then
1345
	 * we should obey the hdrcharset_utf8 flag when converting these.
1346
	 */
1347
	switch (tar->filetype) {
1220
	case '1': /* Hard link */
1348
	case '1': /* Hard link */
1221
		if (archive_entry_copy_hardlink_l(entry, tar->entry_linkpath.s,
1349
		archive_entry_set_link_to_hardlink(entry);
1222
		    archive_strlen(&(tar->entry_linkpath)), tar->sconv) != 0) {
1350
		existing_wcs_linkpath = archive_entry_hardlink_w(entry);
1223
			err = set_conversion_failed_error(a, tar->sconv,
1351
		existing_linkpath = archive_entry_hardlink(entry);
1224
			    "Linkname");
1352
		if ((existing_linkpath == NULL || existing_linkpath[0] == '\0')
1225
			if (err == ARCHIVE_FATAL)
1353
		    && (existing_wcs_linkpath == NULL || existing_wcs_linkpath[0] == '\0')) {
1226
				return (err);
1354
			struct archive_string linkpath;
1355
			archive_string_init(&linkpath);
1356
			archive_strncpy(&linkpath,
1357
					header->linkname, sizeof(header->linkname));
1358
			if (archive_entry_copy_hardlink_l(entry, linkpath.s,
1359
							  archive_strlen(&linkpath), tar->sconv) != 0) {
1360
				err = set_conversion_failed_error(a, tar->sconv,
1361
								  "Linkname");
1362
				if (err == ARCHIVE_FATAL) {
1363
					archive_string_free(&linkpath);
1364
					return (err);
1365
				}
1366
			}
1367
			archive_string_free(&linkpath);
1227
		}
1368
		}
1228
		/*
1369
		/*
1229
		 * The following may seem odd, but: Technically, tar
1370
		 * The following may seem odd, but: Technically, tar
Lines 1283-1298 header_common(struct archive_read *a, struct tar *tar, Link Here
1283
		 */
1424
		 */
1284
		break;
1425
		break;
1285
	case '2': /* Symlink */
1426
	case '2': /* Symlink */
1427
		archive_entry_set_link_to_symlink(entry);
1428
		existing_wcs_linkpath = archive_entry_symlink_w(entry);
1429
		existing_linkpath = archive_entry_symlink(entry);
1430
		if ((existing_linkpath == NULL || existing_linkpath[0] == '\0')
1431
		    && (existing_wcs_linkpath == NULL || existing_wcs_linkpath[0] == '\0')) {
1432
			struct archive_string linkpath;
1433
			archive_string_init(&linkpath);
1434
			archive_strncpy(&linkpath,
1435
					header->linkname, sizeof(header->linkname));
1436
			if (archive_entry_copy_symlink_l(entry, linkpath.s,
1437
			    archive_strlen(&linkpath), tar->sconv) != 0) {
1438
				err = set_conversion_failed_error(a, tar->sconv,
1439
				    "Linkname");
1440
				if (err == ARCHIVE_FATAL) {
1441
					archive_string_free(&linkpath);
1442
					return (err);
1443
				}
1444
			}
1445
			archive_string_free(&linkpath);
1446
		}
1286
		archive_entry_set_filetype(entry, AE_IFLNK);
1447
		archive_entry_set_filetype(entry, AE_IFLNK);
1287
		archive_entry_set_size(entry, 0);
1448
		archive_entry_set_size(entry, 0);
1288
		tar->entry_bytes_remaining = 0;
1449
		tar->entry_bytes_remaining = 0;
1289
		if (archive_entry_copy_symlink_l(entry, tar->entry_linkpath.s,
1290
		    archive_strlen(&(tar->entry_linkpath)), tar->sconv) != 0) {
1291
			err = set_conversion_failed_error(a, tar->sconv,
1292
			    "Linkname");
1293
			if (err == ARCHIVE_FATAL)
1294
				return (err);
1295
		}
1296
		break;
1450
		break;
1297
	case '3': /* Character device */
1451
	case '3': /* Character device */
1298
		archive_entry_set_filetype(entry, AE_IFCHR);
1452
		archive_entry_set_filetype(entry, AE_IFCHR);
Lines 1342-1356 header_common(struct archive_read *a, struct tar *tar, Link Here
1342
		 * sparse information in the extended area.
1496
		 * sparse information in the extended area.
1343
		 */
1497
		 */
1344
		/* FALLTHROUGH */
1498
		/* FALLTHROUGH */
1345
	case '0':
1499
	case '0': /* ustar "regular" file */
1346
		/*
1347
		 * Enable sparse file "read" support only for regular
1348
		 * files and explicit GNU sparse files.  However, we
1349
		 * don't allow non-standard file types to be sparse.
1350
		 */
1351
		tar->sparse_allowed = 1;
1352
		/* FALLTHROUGH */
1500
		/* FALLTHROUGH */
1353
	default: /* Regular file  and non-standard types */
1501
	default: /* Non-standard file types */
1354
		/*
1502
		/*
1355
		 * Per POSIX: non-recognized types should always be
1503
		 * Per POSIX: non-recognized types should always be
1356
		 * treated as regular files.
1504
		 * treated as regular files.
Lines 1371-1379 header_old_tar(struct archive_read *a, struct tar *tar, Link Here
1371
	const struct archive_entry_header_ustar	*header;
1519
	const struct archive_entry_header_ustar	*header;
1372
	int err = ARCHIVE_OK, err2;
1520
	int err = ARCHIVE_OK, err2;
1373
1521
1374
	/* Copy filename over (to ensure null termination). */
1522
	/*
1523
	 * Copy filename over (to ensure null termination).
1524
	 * Skip if pathname was already set e.g. by header_gnu_longname()
1525
	 */
1375
	header = (const struct archive_entry_header_ustar *)h;
1526
	header = (const struct archive_entry_header_ustar *)h;
1376
	if (archive_entry_copy_pathname_l(entry,
1527
1528
	const char *existing_pathname = archive_entry_pathname(entry);
1529
	const wchar_t *existing_wcs_pathname = archive_entry_pathname_w(entry);
1530
	if ((existing_pathname == NULL || existing_pathname[0] == '\0')
1531
	    && (existing_wcs_pathname == NULL || existing_wcs_pathname[0] == '\0') &&
1532
	    archive_entry_copy_pathname_l(entry,
1377
	    header->name, sizeof(header->name), tar->sconv) != 0) {
1533
	    header->name, sizeof(header->name), tar->sconv) != 0) {
1378
		err = set_conversion_failed_error(a, tar->sconv, "Pathname");
1534
		err = set_conversion_failed_error(a, tar->sconv, "Pathname");
1379
		if (err == ARCHIVE_FATAL)
1535
		if (err == ARCHIVE_FATAL)
Lines 1390-1410 header_old_tar(struct archive_read *a, struct tar *tar, Link Here
1390
}
1546
}
1391
1547
1392
/*
1548
/*
1393
 * Read a Mac AppleDouble-encoded blob of file metadata,
1549
 * Is this likely an AppleDouble extension?
1394
 * if there is one.
1395
 */
1550
 */
1396
static int
1551
static int
1397
read_mac_metadata_blob(struct archive_read *a, struct tar *tar,
1552
is_mac_metadata_entry(struct archive_entry *entry) {
1398
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1399
{
1400
	int64_t size;
1401
	size_t msize;
1402
	const void *data;
1403
	const char *p, *name;
1553
	const char *p, *name;
1404
	const wchar_t *wp, *wname;
1554
	const wchar_t *wp, *wname;
1405
1555
1406
	(void)h; /* UNUSED */
1407
1408
	wname = wp = archive_entry_pathname_w(entry);
1556
	wname = wp = archive_entry_pathname_w(entry);
1409
	if (wp != NULL) {
1557
	if (wp != NULL) {
1410
		/* Find the last path element. */
1558
		/* Find the last path element. */
Lines 1416-1423 read_mac_metadata_blob(struct archive_read *a, struct tar *tar, Link Here
1416
		 * If last path element starts with "._", then
1564
		 * If last path element starts with "._", then
1417
		 * this is a Mac extension.
1565
		 * this is a Mac extension.
1418
		 */
1566
		 */
1419
		if (wname[0] != L'.' || wname[1] != L'_' || wname[2] == L'\0')
1567
		if (wname[0] == L'.' && wname[1] == L'_' && wname[2] != L'\0')
1420
			return ARCHIVE_OK;
1568
			return 1;
1421
	} else {
1569
	} else {
1422
		/* Find the last path element. */
1570
		/* Find the last path element. */
1423
		name = p = archive_entry_pathname(entry);
1571
		name = p = archive_entry_pathname(entry);
Lines 1431-1439 read_mac_metadata_blob(struct archive_read *a, struct tar *tar, Link Here
1431
		 * If last path element starts with "._", then
1579
		 * If last path element starts with "._", then
1432
		 * this is a Mac extension.
1580
		 * this is a Mac extension.
1433
		 */
1581
		 */
1434
		if (name[0] != '.' || name[1] != '_' || name[2] == '\0')
1582
		if (name[0] == '.' && name[1] == '_' && name[2] != '\0')
1435
			return ARCHIVE_OK;
1583
			return 1;
1436
	}
1584
	}
1585
	/* Not a mac extension */
1586
	return 0;
1587
}
1588
1589
/*
1590
 * Read a Mac AppleDouble-encoded blob of file metadata,
1591
 * if there is one.
1592
 *
1593
 * TODO: In Libarchive 4, we should consider ripping this
1594
 * out -- instead, return a file starting with `._` as
1595
 * a regular file and let the client (or archive_write logic)
1596
 * handle it.
1597
 */
1598
static int
1599
read_mac_metadata_blob(struct archive_read *a,
1600
    struct archive_entry *entry, size_t *unconsumed)
1601
{
1602
	int64_t size;
1603
	size_t msize;
1604
	const void *data;
1437
1605
1438
 	/* Read the body as a Mac OS metadata blob. */
1606
 	/* Read the body as a Mac OS metadata blob. */
1439
	size = archive_entry_size(entry);
1607
	size = archive_entry_size(entry);
Lines 1443-1448 read_mac_metadata_blob(struct archive_read *a, struct tar *tar, Link Here
1443
		return (ARCHIVE_FATAL);
1611
		return (ARCHIVE_FATAL);
1444
	}
1612
	}
1445
1613
1614
	/* TODO: Should this merely skip the overlarge entry and
1615
	 * WARN?  Or is xattr_limit sufficiently large that we can
1616
	 * safely assume anything larger is malicious? */
1617
	if (size > (int64_t)xattr_limit) {
1618
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1619
		    "Oversized AppleDouble extension has size %llu > %llu",
1620
		    (unsigned long long)size,
1621
		    (unsigned long long)xattr_limit);
1622
		return (ARCHIVE_FATAL);
1623
	}
1624
1446
	/*
1625
	/*
1447
	 * TODO: Look beyond the body here to peek at the next header.
1626
	 * TODO: Look beyond the body here to peek at the next header.
1448
	 * If it's a regular header (not an extension header)
1627
	 * If it's a regular header (not an extension header)
Lines 1455-1469 read_mac_metadata_blob(struct archive_read *a, struct tar *tar, Link Here
1455
	 * Q: Is the above idea really possible?  Even
1634
	 * Q: Is the above idea really possible?  Even
1456
	 * when there are GNU or pax extension entries?
1635
	 * when there are GNU or pax extension entries?
1457
	 */
1636
	 */
1637
	tar_flush_unconsumed(a, unconsumed);
1458
	data = __archive_read_ahead(a, msize, NULL);
1638
	data = __archive_read_ahead(a, msize, NULL);
1459
	if (data == NULL) {
1639
	if (data == NULL) {
1640
		archive_set_error(&a->archive, EINVAL,
1641
		    "Truncated archive"
1642
		    " detected while reading macOS metadata");
1460
		*unconsumed = 0;
1643
		*unconsumed = 0;
1461
		return (ARCHIVE_FATAL);
1644
		return (ARCHIVE_FATAL);
1462
	}
1645
	}
1646
	archive_entry_clear(entry);
1463
	archive_entry_copy_mac_metadata(entry, data, msize);
1647
	archive_entry_copy_mac_metadata(entry, data, msize);
1464
	*unconsumed = (msize + 511) & ~ 511;
1648
	*unconsumed = (msize + 511) & ~ 511;
1465
	tar_flush_unconsumed(a, unconsumed);
1649
	return (ARCHIVE_OK);
1466
	return (tar_read_header(a, tar, entry, unconsumed));
1467
}
1650
}
1468
1651
1469
/*
1652
/*
Lines 1473-1548 static int Link Here
1473
header_pax_global(struct archive_read *a, struct tar *tar,
1656
header_pax_global(struct archive_read *a, struct tar *tar,
1474
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1657
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1475
{
1658
{
1476
	int err;
1659
	const struct archive_entry_header_ustar *header;
1660
	int64_t size, to_consume;
1477
1661
1478
	err = read_body_to_string(a, tar, &(tar->pax_global), h, unconsumed);
1662
	(void)a; /* UNUSED */
1479
	if (err != ARCHIVE_OK)
1663
	(void)tar; /* UNUSED */
1480
		return (err);
1664
	(void)entry; /* UNUSED */
1481
	err = tar_read_header(a, tar, entry, unconsumed);
1665
1482
	return (err);
1666
	header = (const struct archive_entry_header_ustar *)h;
1667
	size = tar_atol(header->size, sizeof(header->size));
1668
	if (size > entry_limit) {
1669
		return (ARCHIVE_FATAL);
1670
	}
1671
	to_consume = ((size + 511) & ~511);
1672
	*unconsumed += to_consume;
1673
	return (ARCHIVE_OK);
1483
}
1674
}
1484
1675
1676
/*
1677
 * Parse a file header for a Posix "ustar" archive entry.  This also
1678
 * handles "pax" or "extended ustar" entries.
1679
 *
1680
 * In order to correctly handle pax attributes (which precede this),
1681
 * we have to skip parsing any field for which the entry already has
1682
 * contents.
1683
 */
1485
static int
1684
static int
1486
header_pax_extensions(struct archive_read *a, struct tar *tar,
1685
header_ustar(struct archive_read *a, struct tar *tar,
1487
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1686
    struct archive_entry *entry, const void *h)
1488
{
1687
{
1489
	int err, err2;
1688
	const struct archive_entry_header_ustar	*header;
1490
1689
	struct archive_string as;
1491
	err = read_body_to_string(a, tar, &(tar->pax_header), h, unconsumed);
1690
	int err = ARCHIVE_OK, r;
1492
	if (err != ARCHIVE_OK)
1493
		return (err);
1494
1495
	/* Parse the next header. */
1496
	err = tar_read_header(a, tar, entry, unconsumed);
1497
	if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
1498
		return (err);
1499
1500
	/*
1501
	 * TODO: Parse global/default options into 'entry' struct here
1502
	 * before handling file-specific options.
1503
	 *
1504
	 * This design (parse standard header, then overwrite with pax
1505
	 * extended attribute data) usually works well, but isn't ideal;
1506
	 * it would be better to parse the pax extended attributes first
1507
	 * and then skip any fields in the standard header that were
1508
	 * defined in the pax header.
1509
	 */
1510
	err2 = pax_header(a, tar, entry, &tar->pax_header);
1511
	err =  err_combine(err, err2);
1512
	tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
1513
	return (err);
1514
}
1515
1516
1517
/*
1518
 * Parse a file header for a Posix "ustar" archive entry.  This also
1519
 * handles "pax" or "extended ustar" entries.
1520
 */
1521
static int
1522
header_ustar(struct archive_read *a, struct tar *tar,
1523
    struct archive_entry *entry, const void *h)
1524
{
1525
	const struct archive_entry_header_ustar	*header;
1526
	struct archive_string *as;
1527
	int err = ARCHIVE_OK, r;
1528
1691
1529
	header = (const struct archive_entry_header_ustar *)h;
1692
	header = (const struct archive_entry_header_ustar *)h;
1530
1693
1531
	/* Copy name into an internal buffer to ensure null-termination. */
1694
	/* Copy name into an internal buffer to ensure null-termination. */
1532
	as = &(tar->entry_pathname);
1695
	const char *existing_pathname = archive_entry_pathname(entry);
1533
	if (header->prefix[0]) {
1696
	const wchar_t *existing_wcs_pathname = archive_entry_pathname_w(entry);
1534
		archive_strncpy(as, header->prefix, sizeof(header->prefix));
1697
	if ((existing_pathname == NULL || existing_pathname[0] == '\0')
1535
		if (as->s[archive_strlen(as) - 1] != '/')
1698
	    && (existing_wcs_pathname == NULL || existing_wcs_pathname[0] == '\0')) {
1536
			archive_strappend_char(as, '/');
1699
		archive_string_init(&as);
1537
		archive_strncat(as, header->name, sizeof(header->name));
1700
		if (header->prefix[0]) {
1538
	} else {
1701
			archive_strncpy(&as, header->prefix, sizeof(header->prefix));
1539
		archive_strncpy(as, header->name, sizeof(header->name));
1702
			if (as.s[archive_strlen(&as) - 1] != '/')
1540
	}
1703
				archive_strappend_char(&as, '/');
1541
	if (archive_entry_copy_pathname_l(entry, as->s, archive_strlen(as),
1704
			archive_strncat(&as, header->name, sizeof(header->name));
1542
	    tar->sconv) != 0) {
1705
		} else {
1543
		err = set_conversion_failed_error(a, tar->sconv, "Pathname");
1706
			archive_strncpy(&as, header->name, sizeof(header->name));
1544
		if (err == ARCHIVE_FATAL)
1707
		}
1545
			return (err);
1708
		if (archive_entry_copy_pathname_l(entry, as.s, archive_strlen(&as),
1709
		    tar->sconv) != 0) {
1710
			err = set_conversion_failed_error(a, tar->sconv, "Pathname");
1711
			if (err == ARCHIVE_FATAL)
1712
				return (err);
1713
		}
1714
		archive_string_free(&as);
1546
	}
1715
	}
1547
1716
1548
	/* Handle rest of common fields. */
1717
	/* Handle rest of common fields. */
Lines 1553-1578 header_ustar(struct archive_read *a, struct tar *tar, Link Here
1553
		err = r;
1722
		err = r;
1554
1723
1555
	/* Handle POSIX ustar fields. */
1724
	/* Handle POSIX ustar fields. */
1556
	if (archive_entry_copy_uname_l(entry,
1725
	const char *existing_uname = archive_entry_uname(entry);
1557
	    header->uname, sizeof(header->uname), tar->sconv) != 0) {
1726
	if (existing_uname == NULL || existing_uname[0] == '\0') {
1558
		err = set_conversion_failed_error(a, tar->sconv, "Uname");
1727
		if (archive_entry_copy_uname_l(entry,
1559
		if (err == ARCHIVE_FATAL)
1728
		    header->uname, sizeof(header->uname), tar->sconv) != 0) {
1560
			return (err);
1729
			err = set_conversion_failed_error(a, tar->sconv, "Uname");
1730
			if (err == ARCHIVE_FATAL)
1731
				return (err);
1732
		}
1561
	}
1733
	}
1562
1734
1563
	if (archive_entry_copy_gname_l(entry,
1735
	const char *existing_gname = archive_entry_gname(entry);
1564
	    header->gname, sizeof(header->gname), tar->sconv) != 0) {
1736
	if (existing_gname == NULL || existing_gname[0] == '\0') {
1565
		err = set_conversion_failed_error(a, tar->sconv, "Gname");
1737
		if (archive_entry_copy_gname_l(entry,
1566
		if (err == ARCHIVE_FATAL)
1738
		    header->gname, sizeof(header->gname), tar->sconv) != 0) {
1567
			return (err);
1739
			err = set_conversion_failed_error(a, tar->sconv, "Gname");
1740
			if (err == ARCHIVE_FATAL)
1741
				return (err);
1742
		}
1568
	}
1743
	}
1569
1744
1570
	/* Parse out device numbers only for char and block specials. */
1745
	/* Parse out device numbers only for char and block specials. */
1571
	if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
1746
	if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
1572
		archive_entry_set_rdevmajor(entry, (dev_t)
1747
		if (!archive_entry_rdev_is_set(entry)) {
1573
		    tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
1748
			archive_entry_set_rdevmajor(entry, (dev_t)
1574
		archive_entry_set_rdevminor(entry, (dev_t)
1749
			    tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
1575
		    tar_atol(header->rdevminor, sizeof(header->rdevminor)));
1750
			archive_entry_set_rdevminor(entry, (dev_t)
1751
			    tar_atol(header->rdevminor, sizeof(header->rdevminor)));
1752
		}
1753
	} else {
1754
		archive_entry_set_rdev(entry, 0);
1576
	}
1755
	}
1577
1756
1578
	tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
1757
	tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
Lines 1580-1696 header_ustar(struct archive_read *a, struct tar *tar, Link Here
1580
	return (err);
1759
	return (err);
1581
}
1760
}
1582
1761
1583
1584
/*
1585
 * Parse the pax extended attributes record.
1586
 *
1587
 * Returns non-zero if there's an error in the data.
1588
 */
1589
static int
1762
static int
1590
pax_header(struct archive_read *a, struct tar *tar,
1763
header_pax_extension(struct archive_read *a, struct tar *tar,
1591
    struct archive_entry *entry, struct archive_string *in_as)
1764
    struct archive_entry *entry, const void *h, size_t *unconsumed)
1592
{
1765
{
1593
	size_t attr_length, l, line_length, value_length;
1766
	/* Sanity checks: The largest `x` body I've ever heard of was
1594
	char *p;
1767
	 * a little over 4MB.  So I doubt there has ever been a
1595
	char *key, *value;
1768
	 * well-formed archive with an `x` body over 1GiB.  Similarly,
1596
	struct archive_string *as;
1769
	 * it seems plausible that no single attribute has ever been
1770
	 * larger than 100MB.  So if we see a larger value here, it's
1771
	 * almost certainly a sign of a corrupted/malicious archive. */
1772
1773
	/* Maximum sane size for extension body: 1 GiB */
1774
	/* This cannot be raised to larger than 8GiB without
1775
	 * exceeding the maximum size for a standard ustar
1776
	 * entry. */
1777
	const int64_t ext_size_limit = 1024 * 1024 * (int64_t)1024;
1778
	/* Maximum size for a single line/attr: 100 million characters */
1779
	/* This cannot be raised to more than 2GiB without exceeding
1780
	 * a `size_t` on 32-bit platforms. */
1781
	const size_t max_parsed_line_length = 99999999ULL;
1782
	/* Largest attribute prolog:  size + name. */
1783
	const size_t max_size_name = 512;
1784
1785
	/* Size and padding of the full extension body */
1786
	int64_t ext_size, ext_padding;
1787
	size_t line_length, value_length, name_length;
1788
	ssize_t to_read, did_read;
1789
	const struct archive_entry_header_ustar *header;
1790
	const char *p, *attr_start, *name_start;
1597
	struct archive_string_conv *sconv;
1791
	struct archive_string_conv *sconv;
1598
	int err, err2;
1792
	struct archive_string *pas = NULL;
1599
	char *attr = in_as->s;
1793
	struct archive_string attr_name;
1794
	int err = ARCHIVE_OK, r;
1600
1795
1601
	attr_length = in_as->length;
1796
	header = (const struct archive_entry_header_ustar *)h;
1602
	tar->pax_hdrcharset_binary = 0;
1797
	ext_size  = tar_atol(header->size, sizeof(header->size));
1603
	archive_string_empty(&(tar->entry_gname));
1798
	if (ext_size > entry_limit) {
1604
	archive_string_empty(&(tar->entry_linkpath));
1799
		return (ARCHIVE_FATAL);
1605
	archive_string_empty(&(tar->entry_pathname));
1800
	}
1606
	archive_string_empty(&(tar->entry_pathname_override));
1801
	if (ext_size < 0) {
1607
	archive_string_empty(&(tar->entry_uname));
1802
	  archive_set_error(&a->archive, EINVAL,
1608
	err = ARCHIVE_OK;
1803
			    "pax extension header has invalid size: %lld",
1609
	while (attr_length > 0) {
1804
			    (long long)ext_size);
1610
		/* Parse decimal length field at start of line. */
1805
	  return (ARCHIVE_FATAL);
1806
	}
1807
1808
	ext_padding = 0x1ff & (-ext_size);
1809
	if (ext_size > ext_size_limit) {
1810
		/* Consume the pax extension body and return an error */
1811
		if (ext_size + ext_padding != __archive_read_consume(a, ext_size + ext_padding)) {
1812
			return (ARCHIVE_FATAL);
1813
		}
1814
		archive_set_error(&a->archive, EINVAL,
1815
		    "Ignoring oversized pax extensions: %d > %d",
1816
		    (int)ext_size, (int)ext_size_limit);
1817
		return (ARCHIVE_WARN);
1818
	}
1819
	tar_flush_unconsumed(a, unconsumed);
1820
1821
	/* Parse the size/name of each pax attribute in the body */
1822
	archive_string_init(&attr_name);
1823
	while (ext_size > 0) {
1824
		/* Read enough bytes to parse the size/name of the next attribute */
1825
		to_read = max_size_name;
1826
		if (to_read > ext_size) {
1827
			to_read = ext_size;
1828
		}
1829
		p = __archive_read_ahead(a, to_read, &did_read);
1830
		if (p == NULL) { /* EOF */
1831
			archive_set_error(&a->archive, EINVAL,
1832
					  "Truncated tar archive"
1833
					  " detected while reading pax attribute name");
1834
			return (ARCHIVE_FATAL);
1835
		}
1836
		if (did_read > ext_size) {
1837
			did_read = ext_size;
1838
		}
1839
1840
		/* Parse size of attribute */
1611
		line_length = 0;
1841
		line_length = 0;
1612
		l = attr_length;
1842
		attr_start = p;
1613
		p = attr; /* Record start of line. */
1843
		while (1) {
1614
		while (l>0) {
1844
			if (p >= attr_start + did_read) {
1845
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1846
						  "Ignoring malformed pax attributes: overlarge attribute size field");
1847
				*unconsumed += ext_size + ext_padding;
1848
				return (ARCHIVE_WARN);
1849
			}
1615
			if (*p == ' ') {
1850
			if (*p == ' ') {
1616
				p++;
1851
				p++;
1617
				l--;
1618
				break;
1852
				break;
1619
			}
1853
			}
1620
			if (*p < '0' || *p > '9') {
1854
			if (*p < '0' || *p > '9') {
1621
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1855
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1622
				    "Ignoring malformed pax extended attributes");
1856
						  "Ignoring malformed pax attributes: malformed attribute size field");
1857
				*unconsumed += ext_size + ext_padding;
1623
				return (ARCHIVE_WARN);
1858
				return (ARCHIVE_WARN);
1624
			}
1859
			}
1625
			line_length *= 10;
1860
			line_length *= 10;
1626
			line_length += *p - '0';
1861
			line_length += *p - '0';
1627
			if (line_length > 999999) {
1862
			if (line_length > max_parsed_line_length) {
1628
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1863
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1629
				    "Rejecting pax extended attribute > 1MB");
1864
						  "Ignoring malformed pax attribute: size > %lld",
1865
						  (long long)max_parsed_line_length);
1866
				*unconsumed += ext_size + ext_padding;
1630
				return (ARCHIVE_WARN);
1867
				return (ARCHIVE_WARN);
1631
			}
1868
			}
1632
			p++;
1869
			p++;
1633
			l--;
1634
		}
1870
		}
1635
1871
1636
		/*
1872
		if ((int64_t)line_length > ext_size) {
1637
		 * Parsed length must be no bigger than available data,
1873
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1638
		 * at least 1, and the last character of the line must
1874
						  "Ignoring malformed pax attribute:  %lld > %lld",
1639
		 * be '\n'.
1875
						  (long long)line_length, (long long)ext_size);
1640
		 */
1876
				*unconsumed += ext_size + ext_padding;
1641
		if (line_length > attr_length
1877
				return (ARCHIVE_WARN);
1642
		    || line_length < 1
1643
		    || attr[line_length - 1] != '\n')
1644
		{
1645
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1646
			    "Ignoring malformed pax extended attribute");
1647
			return (ARCHIVE_WARN);
1648
		}
1878
		}
1649
1879
1650
		/* Null-terminate the line. */
1880
		/* Parse name of attribute */
1651
		attr[line_length - 1] = '\0';
1881
		if (p >= attr_start + did_read
1652
1882
		    || p >= attr_start + line_length
1653
		/* Find end of key and null terminate it. */
1883
		    || *p == '=') {
1654
		key = p;
1655
		if (key[0] == '=')
1656
			return (-1);
1657
		while (*p && *p != '=')
1658
			++p;
1659
		if (*p == '\0') {
1660
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1884
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1661
			    "Invalid pax extended attributes");
1885
					  "Ignoring malformed pax attributes: empty name found");
1886
			*unconsumed += ext_size + ext_padding;
1662
			return (ARCHIVE_WARN);
1887
			return (ARCHIVE_WARN);
1663
		}
1888
		}
1664
		*p = '\0';
1889
		name_start = p;
1890
		while (1) {
1891
			if (p >= attr_start + did_read || p >= attr_start + line_length) {
1892
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1893
						  "Ignoring malformed pax attributes: overlarge attribute name");
1894
				*unconsumed += ext_size + ext_padding;
1895
				return (ARCHIVE_WARN);
1896
			}
1897
			if (*p == '=') {
1898
				break;
1899
			}
1900
			p++;
1901
		}
1902
		name_length = p - name_start;
1903
		p++; // Skip '='
1665
1904
1666
		value = p + 1;
1905
		// Save the name before we consume it
1906
		archive_strncpy(&attr_name, name_start, name_length);
1667
1907
1668
		/* Some values may be binary data */
1908
		ext_size -= p - attr_start;
1669
		value_length = attr + line_length - 1 - value;
1909
		value_length = line_length - (p - attr_start);
1670
1910
1671
		/* Identify this attribute and set it in the entry. */
1911
		/* Consume size, name, and `=` */
1672
		err2 = pax_attribute(a, tar, entry, key, value, value_length);
1912
		*unconsumed += p - attr_start;
1673
		if (err2 == ARCHIVE_FATAL)
1913
		tar_flush_unconsumed(a, unconsumed);
1674
			return (err2);
1914
1675
		err = err_combine(err, err2);
1915
		/* pax_attribute will consume value_length - 1 */
1916
		r = pax_attribute(a, tar, entry, attr_name.s, archive_strlen(&attr_name), value_length - 1, unconsumed);
1917
		ext_size -= value_length - 1;
1918
1919
		// Release the allocated attr_name (either here or before every return in this function)
1920
		archive_string_free(&attr_name);
1676
1921
1677
		/* Skip to next line */
1922
		if (r < ARCHIVE_WARN) {
1678
		attr += line_length;
1923
			*unconsumed += ext_size + ext_padding;
1679
		attr_length -= line_length;
1924
			return (r);
1925
		}
1926
		err = err_combine(err, r);
1927
1928
		/* Consume the `\n` that follows the pax attribute value. */
1929
		tar_flush_unconsumed(a, unconsumed);
1930
		p = __archive_read_ahead(a, 1, &did_read);
1931
		if (p == NULL) {
1932
			archive_set_error(&a->archive, EINVAL,
1933
					  "Truncated tar archive"
1934
					  " detected while completing pax attribute");
1935
			return (ARCHIVE_FATAL);
1936
		}
1937
		if (p[0] != '\n') {
1938
			archive_set_error(&a->archive, EINVAL,
1939
					  "Malformed pax attributes");
1940
			*unconsumed += ext_size + ext_padding;
1941
			return (ARCHIVE_WARN);
1942
		}
1943
		ext_size -= 1;
1944
		*unconsumed += 1;
1945
		tar_flush_unconsumed(a, unconsumed);
1680
	}
1946
	}
1947
	*unconsumed += ext_size + ext_padding;
1681
1948
1682
	/*
1949
	/*
1683
	 * PAX format uses UTF-8 as default charset for its metadata
1950
	 * Some PAX values -- pathname, linkpath, uname, gname --
1684
	 * unless hdrcharset=BINARY is present in its header.
1951
	 * can't be copied into the entry until we know the character
1685
	 * We apply the charset specified by the hdrcharset option only
1952
	 * set to use:
1686
	 * when the hdrcharset attribute(in PAX header) is BINARY because
1687
	 * we respect the charset described in PAX header and BINARY also
1688
	 * means that metadata(filename,uname and gname) character-set
1689
	 * is unknown.
1690
	 */
1953
	 */
1691
	if (tar->pax_hdrcharset_binary)
1954
	if (!tar->pax_hdrcharset_utf8)
1955
		/* PAX specified "BINARY", so use the default charset */
1692
		sconv = tar->opt_sconv;
1956
		sconv = tar->opt_sconv;
1693
	else {
1957
	else {
1958
		/* PAX default UTF-8 */
1694
		sconv = archive_string_conversion_from_charset(
1959
		sconv = archive_string_conversion_from_charset(
1695
		    &(a->archive), "UTF-8", 1);
1960
		    &(a->archive), "UTF-8", 1);
1696
		if (sconv == NULL)
1961
		if (sconv == NULL)
Lines 1700-1782 pax_header(struct archive_read *a, struct tar *tar, Link Here
1700
			    SCONV_SET_OPT_UTF8_LIBARCHIVE2X);
1965
			    SCONV_SET_OPT_UTF8_LIBARCHIVE2X);
1701
	}
1966
	}
1702
1967
1968
	/* Pathname */
1969
	pas = NULL;
1970
	if (archive_strlen(&(tar->entry_pathname_override)) > 0) {
1971
		/* Prefer GNU.sparse.name attribute if present */
1972
		/* GNU sparse files store a fake name under the standard
1973
		 * "pathname" key. */
1974
		pas = &(tar->entry_pathname_override);
1975
	} else if (archive_strlen(&(tar->entry_pathname)) > 0) {
1976
		/* Use standard "pathname" PAX extension */
1977
		pas = &(tar->entry_pathname);
1978
	}
1979
	if (pas != NULL) {
1980
		if (archive_entry_copy_pathname_l(entry, pas->s,
1981
		    archive_strlen(pas), sconv) != 0) {
1982
			err = set_conversion_failed_error(a, sconv, "Pathname");
1983
			if (err == ARCHIVE_FATAL)
1984
				return (err);
1985
			/* Use raw name without conversion */
1986
			archive_entry_copy_pathname(entry, pas->s);
1987
		}
1988
	}
1989
	/* Uname */
1990
	if (archive_strlen(&(tar->entry_uname)) > 0) {
1991
		if (archive_entry_copy_uname_l(entry, tar->entry_uname.s,
1992
		    archive_strlen(&(tar->entry_uname)), sconv) != 0) {
1993
			err = set_conversion_failed_error(a, sconv, "Uname");
1994
			if (err == ARCHIVE_FATAL)
1995
				return (err);
1996
			/* Use raw name without conversion */
1997
			archive_entry_copy_uname(entry, tar->entry_uname.s);
1998
		}
1999
	}
2000
	/* Gname */
1703
	if (archive_strlen(&(tar->entry_gname)) > 0) {
2001
	if (archive_strlen(&(tar->entry_gname)) > 0) {
1704
		if (archive_entry_copy_gname_l(entry, tar->entry_gname.s,
2002
		if (archive_entry_copy_gname_l(entry, tar->entry_gname.s,
1705
		    archive_strlen(&(tar->entry_gname)), sconv) != 0) {
2003
		    archive_strlen(&(tar->entry_gname)), sconv) != 0) {
1706
			err = set_conversion_failed_error(a, sconv, "Gname");
2004
			err = set_conversion_failed_error(a, sconv, "Gname");
1707
			if (err == ARCHIVE_FATAL)
2005
			if (err == ARCHIVE_FATAL)
1708
				return (err);
2006
				return (err);
1709
			/* Use a converted an original name. */
2007
			/* Use raw name without conversion */
1710
			archive_entry_copy_gname(entry, tar->entry_gname.s);
2008
			archive_entry_copy_gname(entry, tar->entry_gname.s);
1711
		}
2009
		}
1712
	}
2010
	}
2011
	/* Linkpath */
1713
	if (archive_strlen(&(tar->entry_linkpath)) > 0) {
2012
	if (archive_strlen(&(tar->entry_linkpath)) > 0) {
1714
		if (archive_entry_copy_link_l(entry, tar->entry_linkpath.s,
2013
		if (archive_entry_copy_link_l(entry, tar->entry_linkpath.s,
1715
		    archive_strlen(&(tar->entry_linkpath)), sconv) != 0) {
2014
		    archive_strlen(&(tar->entry_linkpath)), sconv) != 0) {
1716
			err = set_conversion_failed_error(a, sconv, "Linkname");
2015
			err = set_conversion_failed_error(a, sconv, "Linkpath");
1717
			if (err == ARCHIVE_FATAL)
2016
			if (err == ARCHIVE_FATAL)
1718
				return (err);
2017
				return (err);
1719
			/* Use a converted an original name. */
2018
			/* Use raw name without conversion */
1720
			archive_entry_copy_link(entry, tar->entry_linkpath.s);
2019
			archive_entry_copy_link(entry, tar->entry_linkpath.s);
1721
		}
2020
		}
1722
	}
2021
	}
1723
	/*
2022
1724
	 * Some extensions (such as the GNU sparse file extensions)
2023
	/* Extension may have given us a corrected `entry_bytes_remaining` for
1725
	 * deliberately store a synthetic name under the regular 'path'
2024
	 * the main entry; update the padding appropriately. */
1726
	 * attribute and the real file name under a different attribute.
2025
	tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
1727
	 * Since we're supposed to not care about the order, we
1728
	 * have no choice but to store all of the various filenames
1729
	 * we find and figure it all out afterwards.  This is the
1730
	 * figuring out part.
1731
	 */
1732
	as = NULL;
1733
	if (archive_strlen(&(tar->entry_pathname_override)) > 0)
1734
		as = &(tar->entry_pathname_override);
1735
	else if (archive_strlen(&(tar->entry_pathname)) > 0)
1736
		as = &(tar->entry_pathname);
1737
	if (as != NULL) {
1738
		if (archive_entry_copy_pathname_l(entry, as->s,
1739
		    archive_strlen(as), sconv) != 0) {
1740
			err = set_conversion_failed_error(a, sconv, "Pathname");
1741
			if (err == ARCHIVE_FATAL)
1742
				return (err);
1743
			/* Use a converted an original name. */
1744
			archive_entry_copy_pathname(entry, as->s);
1745
		}
1746
	}
1747
	if (archive_strlen(&(tar->entry_uname)) > 0) {
1748
		if (archive_entry_copy_uname_l(entry, tar->entry_uname.s,
1749
		    archive_strlen(&(tar->entry_uname)), sconv) != 0) {
1750
			err = set_conversion_failed_error(a, sconv, "Uname");
1751
			if (err == ARCHIVE_FATAL)
1752
				return (err);
1753
			/* Use a converted an original name. */
1754
			archive_entry_copy_uname(entry, tar->entry_uname.s);
1755
		}
1756
	}
1757
	return (err);
2026
	return (err);
1758
}
2027
}
1759
2028
1760
static int
2029
static int
1761
pax_attribute_xattr(struct archive_entry *entry,
2030
pax_attribute_LIBARCHIVE_xattr(struct archive_entry *entry,
1762
	const char *name, const char *value)
2031
	const char *name, size_t name_length, const char *value, size_t value_length)
1763
{
2032
{
1764
	char *name_decoded;
2033
	char *name_decoded;
1765
	void *value_decoded;
2034
	void *value_decoded;
1766
	size_t value_len;
2035
	size_t value_len;
1767
2036
1768
	if (strlen(name) < 18 || (memcmp(name, "LIBARCHIVE.xattr.", 17)) != 0)
2037
	if (name_length < 1)
1769
		return 3;
2038
		return 3;
1770
2039
1771
	name += 17;
1772
1773
	/* URL-decode name */
2040
	/* URL-decode name */
1774
	name_decoded = url_decode(name);
2041
	name_decoded = url_decode(name, name_length);
1775
	if (name_decoded == NULL)
2042
	if (name_decoded == NULL)
1776
		return 2;
2043
		return 2;
1777
2044
1778
	/* Base-64 decode value */
2045
	/* Base-64 decode value */
1779
	value_decoded = base64_decode(value, strlen(value), &value_len);
2046
	value_decoded = base64_decode(value, value_length, &value_len);
1780
	if (value_decoded == NULL) {
2047
	if (value_decoded == NULL) {
1781
		free(name_decoded);
2048
		free(name_decoded);
1782
		return 1;
2049
		return 1;
Lines 1791-1811 pax_attribute_xattr(struct archive_entry *entry, Link Here
1791
}
2058
}
1792
2059
1793
static int
2060
static int
1794
pax_attribute_schily_xattr(struct archive_entry *entry,
2061
pax_attribute_SCHILY_xattr(struct archive_entry *entry,
1795
	const char *name, const char *value, size_t value_length)
2062
	const char *name, size_t name_length, const char *value, size_t value_length)
1796
{
2063
{
1797
	if (strlen(name) < 14 || (memcmp(name, "SCHILY.xattr.", 13)) != 0)
2064
	if (name_length < 1 || name_length > 128) {
1798
		return 1;
2065
		return 1;
2066
	}
1799
2067
1800
	name += 13;
2068
	char * null_terminated_name = malloc(name_length + 1);
1801
2069
	if (null_terminated_name != NULL) {
1802
	archive_entry_xattr_add_entry(entry, name, value, value_length);
2070
		memcpy(null_terminated_name, name, name_length);
2071
		null_terminated_name[name_length] = '\0';
2072
		archive_entry_xattr_add_entry(entry, null_terminated_name, value, value_length);
2073
		free(null_terminated_name);
2074
	}
1803
2075
1804
	return 0;
2076
	return 0;
1805
}
2077
}
1806
2078
1807
static int
2079
static int
1808
pax_attribute_rht_security_selinux(struct archive_entry *entry,
2080
pax_attribute_RHT_security_selinux(struct archive_entry *entry,
1809
	const char *value, size_t value_length)
2081
	const char *value, size_t value_length)
1810
{
2082
{
1811
	archive_entry_xattr_add_entry(entry, "security.selinux",
2083
	archive_entry_xattr_add_entry(entry, "security.selinux",
Lines 1815-1824 pax_attribute_rht_security_selinux(struct archive_entry *entry, Link Here
1815
}
2087
}
1816
2088
1817
static int
2089
static int
1818
pax_attribute_acl(struct archive_read *a, struct tar *tar,
2090
pax_attribute_SCHILY_acl(struct archive_read *a, struct tar *tar,
1819
    struct archive_entry *entry, const char *value, int type)
2091
	struct archive_entry *entry, size_t value_length, int type)
1820
{
2092
{
1821
	int r;
2093
	int r;
2094
	const char *p;
1822
	const char* errstr;
2095
	const char* errstr;
1823
2096
1824
	switch (type) {
2097
	switch (type) {
Lines 1845-1852 pax_attribute_acl(struct archive_read *a, struct tar *tar, Link Here
1845
			return (ARCHIVE_FATAL);
2118
			return (ARCHIVE_FATAL);
1846
	}
2119
	}
1847
2120
1848
	r = archive_acl_from_text_l(archive_entry_acl(entry), value, type,
2121
	if (value_length > acl_limit) {
1849
	    tar->sconv_acl);
2122
		__archive_read_consume(a, value_length);
2123
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2124
				  "Unreasonably large ACL: %d > %d",
2125
				  (int)value_length, (int)acl_limit);
2126
		return (ARCHIVE_WARN);
2127
	}
2128
2129
	p = __archive_read_ahead(a, value_length, NULL);
2130
	if (p == NULL) {
2131
		archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2132
				  "Truncated tar archive "
2133
				  "detected while reading ACL data");
2134
		return (ARCHIVE_FATAL);
2135
	}
2136
2137
	r = archive_acl_from_text_nl(archive_entry_acl(entry), p, value_length,
2138
	    type, tar->sconv_acl);
2139
	__archive_read_consume(a, value_length);
2140
	/* Workaround: Force perm_is_set() to be correct */
2141
	/* If this bit were stored in the ACL, this wouldn't be needed */
2142
	archive_entry_set_perm(entry, archive_entry_perm(entry));
1850
	if (r != ARCHIVE_OK) {
2143
	if (r != ARCHIVE_OK) {
1851
		if (r == ARCHIVE_FATAL) {
2144
		if (r == ARCHIVE_FATAL) {
1852
			archive_set_error(&a->archive, ENOMEM,
2145
			archive_set_error(&a->archive, ENOMEM,
Lines 1860-2101 pax_attribute_acl(struct archive_read *a, struct tar *tar, Link Here
1860
	return (r);
2153
	return (r);
1861
}
2154
}
1862
2155
2156
static int
2157
pax_attribute_read_time(struct archive_read *a, size_t value_length, int64_t *ps, long *pn, size_t *unconsumed) {
2158
	struct archive_string as;
2159
	int r;
2160
2161
	if (value_length > 128) {
2162
		__archive_read_consume(a, value_length);
2163
		*ps = 0;
2164
		*pn = 0;
2165
		return (ARCHIVE_FATAL);
2166
	}
2167
2168
	archive_string_init(&as);
2169
	r = read_bytes_to_string(a, &as, value_length, unconsumed);
2170
	if (r < ARCHIVE_OK) {
2171
		archive_string_free(&as);
2172
		return (r);
2173
	}
2174
2175
	pax_time(as.s, archive_strlen(&as), ps, pn);
2176
	archive_string_free(&as);
2177
	if (*ps < 0 || *ps == INT64_MAX) {
2178
		return (ARCHIVE_WARN);
2179
	}
2180
	return (ARCHIVE_OK);
2181
}
2182
2183
static int
2184
pax_attribute_read_number(struct archive_read *a, size_t value_length, int64_t *result) {
2185
	struct archive_string as;
2186
	size_t unconsumed = 0;
2187
	int r;
2188
2189
	if (value_length > 64) {
2190
		__archive_read_consume(a, value_length);
2191
		*result = 0;
2192
		return (ARCHIVE_FATAL);
2193
	}
2194
2195
	archive_string_init(&as);
2196
	r = read_bytes_to_string(a, &as, value_length, &unconsumed);
2197
	tar_flush_unconsumed(a, &unconsumed);
2198
	if (r < ARCHIVE_OK) {
2199
		archive_string_free(&as);
2200
		return (r);
2201
	}
2202
2203
	*result = tar_atol10(as.s, archive_strlen(&as));
2204
	archive_string_free(&as);
2205
	if (*result < 0 || *result == INT64_MAX) {
2206
		*result = INT64_MAX;
2207
		return (ARCHIVE_WARN);
2208
	}
2209
	return (ARCHIVE_OK);
2210
}
2211
1863
/*
2212
/*
1864
 * Parse a single key=value attribute.  key/value pointers are
2213
 * Parse a single key=value attribute.
1865
 * assumed to point into reasonably long-lived storage.
1866
 *
2214
 *
1867
 * Note that POSIX reserves all-lowercase keywords.  Vendor-specific
2215
 * POSIX reserves all-lowercase keywords.  Vendor-specific extensions
1868
 * extensions should always have keywords of the form "VENDOR.attribute"
2216
 * should always have keywords of the form "VENDOR.attribute" In
1869
 * In particular, it's quite feasible to support many different
2217
 * particular, it's quite feasible to support many different vendor
1870
 * vendor extensions here.  I'm using "LIBARCHIVE" for extensions
2218
 * extensions here.  I'm using "LIBARCHIVE" for extensions unique to
1871
 * unique to this library.
2219
 * this library.
1872
 *
2220
 *
1873
 * Investigate other vendor-specific extensions and see if
2221
 * TODO: Investigate other vendor-specific extensions and see if
1874
 * any of them look useful.
2222
 * any of them look useful.
1875
 */
2223
 */
1876
static int
2224
static int
1877
pax_attribute(struct archive_read *a, struct tar *tar,
2225
pax_attribute(struct archive_read *a, struct tar *tar, struct archive_entry *entry,
1878
    struct archive_entry *entry, const char *key, const char *value, size_t value_length)
2226
	      const char *key, size_t key_length, size_t value_length, size_t *unconsumed)
1879
{
2227
{
1880
	int64_t s;
2228
	int64_t t;
1881
	long n;
2229
	long n;
1882
	int err = ARCHIVE_OK, r;
2230
	const char *p;
2231
	ssize_t bytes_read;
2232
	int err = ARCHIVE_OK;
1883
2233
1884
#ifndef __FreeBSD__
1885
	if (value == NULL)
1886
		value = "";	/* Disable compiler warning; do not pass
1887
				 * NULL pointer to strlen().  */
1888
#endif
1889
	switch (key[0]) {
2234
	switch (key[0]) {
1890
	case 'G':
2235
	case 'G':
1891
		/* Reject GNU.sparse.* headers on non-regular files. */
2236
		/* GNU.* extensions */
1892
		if (strncmp(key, "GNU.sparse", 10) == 0 &&
2237
		if (key_length > 4 && memcmp(key, "GNU.", 4) == 0) {
1893
		    !tar->sparse_allowed) {
2238
			key += 4;
1894
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2239
			key_length -= 4;
1895
			    "Non-regular file cannot be sparse");
2240
1896
			return (ARCHIVE_FATAL);
2241
			/* GNU.sparse marks the existence of GNU sparse information */
1897
		}
2242
			if (key_length == 6 && memcmp(key, "sparse", 6) == 0) {
1898
2243
				tar->sparse_gnu_attributes_seen = 1;
1899
		/* GNU "0.0" sparse pax format. */
1900
		if (strcmp(key, "GNU.sparse.numblocks") == 0) {
1901
			tar->sparse_offset = -1;
1902
			tar->sparse_numbytes = -1;
1903
			tar->sparse_gnu_major = 0;
1904
			tar->sparse_gnu_minor = 0;
1905
		}
1906
		if (strcmp(key, "GNU.sparse.offset") == 0) {
1907
			tar->sparse_offset = tar_atol10(value, strlen(value));
1908
			if (tar->sparse_numbytes != -1) {
1909
				if (gnu_add_sparse_entry(a, tar,
1910
				    tar->sparse_offset, tar->sparse_numbytes)
1911
				    != ARCHIVE_OK)
1912
					return (ARCHIVE_FATAL);
1913
				tar->sparse_offset = -1;
1914
				tar->sparse_numbytes = -1;
1915
			}
2244
			}
1916
		}
1917
		if (strcmp(key, "GNU.sparse.numbytes") == 0) {
1918
			tar->sparse_numbytes = tar_atol10(value, strlen(value));
1919
			if (tar->sparse_offset != -1) {
1920
				if (gnu_add_sparse_entry(a, tar,
1921
				    tar->sparse_offset, tar->sparse_numbytes)
1922
				    != ARCHIVE_OK)
1923
					return (ARCHIVE_FATAL);
1924
				tar->sparse_offset = -1;
1925
				tar->sparse_numbytes = -1;
1926
			}
1927
		}
1928
		if (strcmp(key, "GNU.sparse.size") == 0) {
1929
			tar->realsize = tar_atol10(value, strlen(value));
1930
			archive_entry_set_size(entry, tar->realsize);
1931
			tar->realsize_override = 1;
1932
		}
1933
2245
1934
		/* GNU "0.1" sparse pax format. */
2246
			/* GNU.sparse.* extensions */
1935
		if (strcmp(key, "GNU.sparse.map") == 0) {
2247
			else if (key_length > 7 && memcmp(key, "sparse.", 7) == 0) {
1936
			tar->sparse_gnu_major = 0;
2248
				tar->sparse_gnu_attributes_seen = 1;
1937
			tar->sparse_gnu_minor = 1;
2249
				key += 7;
1938
			if (gnu_sparse_01_parse(a, tar, value) != ARCHIVE_OK)
2250
				key_length -= 7;
1939
				return (ARCHIVE_WARN);
2251
1940
		}
2252
				/* GNU "0.0" sparse pax format. */
1941
2253
				if (key_length == 9 && memcmp(key, "numblocks", 9) == 0) {
1942
		/* GNU "1.0" sparse pax format */
2254
					/* GNU.sparse.numblocks */
1943
		if (strcmp(key, "GNU.sparse.major") == 0) {
2255
					tar->sparse_offset = -1;
1944
			tar->sparse_gnu_major = (int)tar_atol10(value, strlen(value));
2256
					tar->sparse_numbytes = -1;
1945
			tar->sparse_gnu_pending = 1;
2257
					tar->sparse_gnu_major = 0;
1946
		}
2258
					tar->sparse_gnu_minor = 0;
1947
		if (strcmp(key, "GNU.sparse.minor") == 0) {
2259
				}
1948
			tar->sparse_gnu_minor = (int)tar_atol10(value, strlen(value));
2260
				else if (key_length == 6 && memcmp(key, "offset", 6) == 0) {
1949
			tar->sparse_gnu_pending = 1;
2261
					/* GNU.sparse.offset */
1950
		}
2262
					if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
1951
		if (strcmp(key, "GNU.sparse.name") == 0) {
2263
						tar->sparse_offset = t;
1952
			/*
2264
						if (tar->sparse_numbytes != -1) {
1953
			 * The real filename; when storing sparse
2265
							if (gnu_add_sparse_entry(a, tar,
1954
			 * files, GNU tar puts a synthesized name into
2266
									 tar->sparse_offset, tar->sparse_numbytes)
1955
			 * the regular 'path' attribute in an attempt
2267
							    != ARCHIVE_OK)
1956
			 * to limit confusion. ;-)
2268
								return (ARCHIVE_FATAL);
1957
			 */
2269
							tar->sparse_offset = -1;
1958
			archive_strcpy(&(tar->entry_pathname_override), value);
2270
							tar->sparse_numbytes = -1;
1959
		}
2271
						}
1960
		if (strcmp(key, "GNU.sparse.realsize") == 0) {
2272
					}
1961
			tar->realsize = tar_atol10(value, strlen(value));
2273
					return (err);
1962
			archive_entry_set_size(entry, tar->realsize);
2274
				}
1963
			tar->realsize_override = 1;
2275
				else if (key_length == 8 && memcmp(key, "numbytes", 8) == 0) {
2276
					/* GNU.sparse.numbytes */
2277
					if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2278
						tar->sparse_numbytes = t;
2279
						if (tar->sparse_offset != -1) {
2280
							if (gnu_add_sparse_entry(a, tar,
2281
									 tar->sparse_offset, tar->sparse_numbytes)
2282
							    != ARCHIVE_OK)
2283
								return (ARCHIVE_FATAL);
2284
							tar->sparse_offset = -1;
2285
							tar->sparse_numbytes = -1;
2286
						}
2287
					}
2288
					return (err);
2289
				}
2290
				else if (key_length == 4 && memcmp(key, "size", 4) == 0) {
2291
					/* GNU.sparse.size */
2292
					if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2293
						tar->realsize = t;
2294
						archive_entry_set_size(entry, tar->realsize);
2295
						tar->realsize_override = 1;
2296
					}
2297
					return (err);
2298
				}
2299
2300
				/* GNU "0.1" sparse pax format. */
2301
				else if (key_length == 3 && memcmp(key, "map", 3) == 0) {
2302
					/* GNU.sparse.map */
2303
					tar->sparse_gnu_major = 0;
2304
					tar->sparse_gnu_minor = 1;
2305
					if (value_length > sparse_map_limit) {
2306
						archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2307
								  "Unreasonably large sparse map: %d > %d",
2308
								  (int)value_length, (int)sparse_map_limit);
2309
						err = ARCHIVE_FAILED;
2310
					} else {
2311
						p = __archive_read_ahead(a, value_length, &bytes_read);
2312
						if (p == NULL) {
2313
							archive_set_error(&a->archive, EINVAL,
2314
									  "Truncated archive"
2315
									  " detected while reading GNU sparse data");
2316
							return (ARCHIVE_FATAL);
2317
						}
2318
						if (gnu_sparse_01_parse(a, tar, p, value_length) != ARCHIVE_OK) {
2319
							err = ARCHIVE_WARN;
2320
						}
2321
					}
2322
					__archive_read_consume(a, value_length);
2323
					return (err);
2324
				}
2325
2326
				/* GNU "1.0" sparse pax format */
2327
				else if (key_length == 5 && memcmp(key, "major", 5) == 0) {
2328
					/* GNU.sparse.major */
2329
					if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK
2330
					    && t >= 0
2331
					    && t <= 10) {
2332
						tar->sparse_gnu_major = (int)t;
2333
					}
2334
					return (err);
2335
				}
2336
				else if (key_length == 5 && memcmp(key, "minor", 5) == 0) {
2337
					/* GNU.sparse.minor */
2338
					if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK
2339
					    && t >= 0
2340
					    && t <= 10) {
2341
						tar->sparse_gnu_minor = (int)t;
2342
					}
2343
					return (err);
2344
				}
2345
				else if (key_length == 4 && memcmp(key, "name", 4) == 0) {
2346
					/* GNU.sparse.name */
2347
					/*
2348
					 * The real filename; when storing sparse
2349
					 * files, GNU tar puts a synthesized name into
2350
					 * the regular 'path' attribute in an attempt
2351
					 * to limit confusion. ;-)
2352
					 */
2353
					if (value_length > pathname_limit) {
2354
						*unconsumed += value_length;
2355
						err = ARCHIVE_WARN;
2356
					} else {
2357
						err = read_bytes_to_string(a, &(tar->entry_pathname_override),
2358
									   value_length, unconsumed);
2359
					}
2360
					return (err);
2361
				}
2362
				else if (key_length == 8 && memcmp(key, "realsize", 8) == 0) {
2363
					/* GNU.sparse.realsize */
2364
					if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2365
						tar->realsize = t;
2366
						archive_entry_set_size(entry, tar->realsize);
2367
						tar->realsize_override = 1;
2368
					}
2369
					return (err);
2370
				}
2371
			}
1964
		}
2372
		}
1965
		break;
2373
		break;
1966
	case 'L':
2374
	case 'L':
1967
		/* Our extensions */
2375
		/* LIBARCHIVE extensions */
1968
/* TODO: Handle arbitrary extended attributes... */
2376
		if (key_length > 11 && memcmp(key, "LIBARCHIVE.", 11) == 0) {
1969
/*
2377
			key_length -= 11;
1970
		if (strcmp(key, "LIBARCHIVE.xxxxxxx") == 0)
2378
			key += 11;
1971
			archive_entry_set_xxxxxx(entry, value);
2379
1972
*/
2380
			/* TODO: Handle arbitrary extended attributes... */
1973
		if (strcmp(key, "LIBARCHIVE.creationtime") == 0) {
2381
			/*
1974
			pax_time(value, &s, &n);
2382
			  if (strcmp(key, "LIBARCHIVE.xxxxxxx") == 0)
1975
			archive_entry_set_birthtime(entry, s, n);
2383
				  archive_entry_set_xxxxxx(entry, value);
1976
		}
2384
			*/
1977
		if (strcmp(key, "LIBARCHIVE.symlinktype") == 0) {
2385
			if (key_length == 12 && memcmp(key, "creationtime", 12) == 0) {
1978
			if (strcmp(value, "file") == 0) {
2386
				/* LIBARCHIVE.creationtime */
1979
				archive_entry_set_symlink_type(entry,
2387
				if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
1980
				    AE_SYMLINK_TYPE_FILE);
2388
					archive_entry_set_birthtime(entry, t, n);
1981
			} else if (strcmp(value, "dir") == 0) {
2389
				}
1982
				archive_entry_set_symlink_type(entry,
2390
				return (err);
1983
				    AE_SYMLINK_TYPE_DIRECTORY);
2391
			}
2392
			else if (key_length == 11 && memcmp(key, "symlinktype", 11) == 0) {
2393
				/* LIBARCHIVE.symlinktype */
2394
				if (value_length < 16) {
2395
					p = __archive_read_ahead(a, value_length, &bytes_read);
2396
					if (p == NULL) {
2397
						archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2398
								  "Truncated tar archive "
2399
								  "detected while reading `symlinktype` attribute");
2400
						return (ARCHIVE_FATAL);
2401
					}
2402
					if (value_length == 4 && memcmp(p, "file", 4) == 0) {
2403
						archive_entry_set_symlink_type(entry,
2404
									       AE_SYMLINK_TYPE_FILE);
2405
					} else if (value_length == 3 && memcmp(p, "dir", 3) == 0) {
2406
							archive_entry_set_symlink_type(entry,
2407
										       AE_SYMLINK_TYPE_DIRECTORY);
2408
					} else {
2409
						archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2410
								  "Unrecognized symlink type");
2411
						err = ARCHIVE_WARN;
2412
					}
2413
				} else {
2414
					archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2415
							  "symlink type is very long"
2416
							  "(longest recognized value is 4 bytes, this is %d)",
2417
							  (int)value_length);
2418
					err = ARCHIVE_WARN;
2419
				}
2420
				__archive_read_consume(a, value_length);
2421
				return (err);
2422
			}
2423
			else if (key_length > 6 && memcmp(key, "xattr.", 6) == 0) {
2424
				key_length -= 6;
2425
				key += 6;
2426
				if (value_length > xattr_limit) {
2427
					err = ARCHIVE_WARN;
2428
				} else {
2429
					p = __archive_read_ahead(a, value_length, &bytes_read);
2430
					if (p == NULL) {
2431
						archive_set_error(&a->archive, EINVAL,
2432
								  "Truncated archive"
2433
								  " detected while reading xattr information");
2434
						return (ARCHIVE_FATAL);
2435
					}
2436
					if (pax_attribute_LIBARCHIVE_xattr(entry, key, key_length, p, value_length)) {
2437
						/* TODO: Unable to parse xattr */
2438
						err = ARCHIVE_WARN;
2439
					}
2440
				}
2441
				__archive_read_consume(a, value_length);
2442
				return (err);
1984
			}
2443
			}
1985
		}
2444
		}
1986
		if (memcmp(key, "LIBARCHIVE.xattr.", 17) == 0)
1987
			pax_attribute_xattr(entry, key, value);
1988
		break;
2445
		break;
1989
	case 'R':
2446
	case 'R':
1990
		/* GNU tar uses RHT.security header to store SELinux xattrs
2447
		/* GNU tar uses RHT.security header to store SELinux xattrs
1991
		 * SCHILY.xattr.security.selinux == RHT.security.selinux */
2448
		 * SCHILY.xattr.security.selinux == RHT.security.selinux */
1992
		if (strcmp(key, "RHT.security.selinux") == 0) {
2449
		if (key_length == 20 && memcmp(key, "RHT.security.selinux", 20) == 0) {
1993
			pax_attribute_rht_security_selinux(entry, value,
2450
			if (value_length > xattr_limit) {
1994
			    value_length);
2451
				archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2452
						  "Ignoring unreasonably large security.selinux attribute:"
2453
						  " %d > %d",
2454
						  (int)value_length, (int)xattr_limit);
2455
				/* TODO: Should this be FAILED instead? */
2456
				err = ARCHIVE_WARN;
2457
			} else {
2458
				p = __archive_read_ahead(a, value_length, &bytes_read);
2459
				if (p == NULL) {
2460
					archive_set_error(&a->archive, EINVAL,
2461
							  "Truncated archive"
2462
							  " detected while reading selinux data");
2463
					return (ARCHIVE_FATAL);
2464
				}
2465
				if (pax_attribute_RHT_security_selinux(entry, p, value_length)) {
2466
					/* TODO: Unable to parse xattr */
2467
					err = ARCHIVE_WARN;
2468
				}
1995
			}
2469
			}
2470
			__archive_read_consume(a, value_length);
2471
			return (err);
2472
		}
1996
		break;
2473
		break;
1997
	case 'S':
2474
	case 'S':
1998
		/* We support some keys used by the "star" archiver */
2475
		/* SCHILY.* extensions used by "star" archiver */
1999
		if (strcmp(key, "SCHILY.acl.access") == 0) {
2476
		if (key_length > 7 && memcmp(key, "SCHILY.", 7) == 0) {
2000
			r = pax_attribute_acl(a, tar, entry, value,
2477
			key_length -= 7;
2001
			    ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
2478
			key += 7;
2002
			if (r == ARCHIVE_FATAL)
2479
2003
				return (r);
2480
			if (key_length == 10 && memcmp(key, "acl.access", 10) == 0) {
2004
		} else if (strcmp(key, "SCHILY.acl.default") == 0) {
2481
				err = pax_attribute_SCHILY_acl(a, tar, entry, value_length,
2005
			r = pax_attribute_acl(a, tar, entry, value,
2482
						      ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
2006
			    ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
2483
				// TODO: Mark mode as set
2007
			if (r == ARCHIVE_FATAL)
2484
				return (err);
2008
				return (r);
2485
			}
2009
		} else if (strcmp(key, "SCHILY.acl.ace") == 0) {
2486
			else if (key_length == 11 && memcmp(key, "acl.default", 11) == 0) {
2010
			r = pax_attribute_acl(a, tar, entry, value,
2487
				err = pax_attribute_SCHILY_acl(a, tar, entry, value_length,
2011
			    ARCHIVE_ENTRY_ACL_TYPE_NFS4);
2488
						      ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
2012
			if (r == ARCHIVE_FATAL)
2489
				return (err);
2013
				return (r);
2490
			}
2014
		} else if (strcmp(key, "SCHILY.devmajor") == 0) {
2491
			else if (key_length == 7 && memcmp(key, "acl.ace", 7) == 0) {
2015
			archive_entry_set_rdevmajor(entry,
2492
				err = pax_attribute_SCHILY_acl(a, tar, entry, value_length,
2016
			    (dev_t)tar_atol10(value, strlen(value)));
2493
						      ARCHIVE_ENTRY_ACL_TYPE_NFS4);
2017
		} else if (strcmp(key, "SCHILY.devminor") == 0) {
2494
				// TODO: Mark mode as set
2018
			archive_entry_set_rdevminor(entry,
2495
				return (err);
2019
			    (dev_t)tar_atol10(value, strlen(value)));
2496
			}
2020
		} else if (strcmp(key, "SCHILY.fflags") == 0) {
2497
			else if (key_length == 8 && memcmp(key, "devmajor", 8) == 0) {
2021
			archive_entry_copy_fflags_text(entry, value);
2498
				if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2022
		} else if (strcmp(key, "SCHILY.dev") == 0) {
2499
					archive_entry_set_rdevmajor(entry, (dev_t)t);
2023
			archive_entry_set_dev(entry,
2500
				}
2024
			    (dev_t)tar_atol10(value, strlen(value)));
2501
				return (err);
2025
		} else if (strcmp(key, "SCHILY.ino") == 0) {
2502
			}
2026
			archive_entry_set_ino(entry,
2503
			else if (key_length == 8 && memcmp(key, "devminor", 8) == 0) {
2027
			    tar_atol10(value, strlen(value)));
2504
				if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2028
		} else if (strcmp(key, "SCHILY.nlink") == 0) {
2505
					archive_entry_set_rdevminor(entry, (dev_t)t);
2029
			archive_entry_set_nlink(entry, (unsigned)
2506
				}
2030
			    tar_atol10(value, strlen(value)));
2507
				return (err);
2031
		} else if (strcmp(key, "SCHILY.realsize") == 0) {
2508
			}
2032
			tar->realsize = tar_atol10(value, strlen(value));
2509
			else if (key_length == 6 && memcmp(key, "fflags", 6) == 0) {
2033
			tar->realsize_override = 1;
2510
				if (value_length < fflags_limit) {
2034
			archive_entry_set_size(entry, tar->realsize);
2511
					p = __archive_read_ahead(a, value_length, &bytes_read);
2035
		} else if (strncmp(key, "SCHILY.xattr.", 13) == 0) {
2512
					if (p == NULL) {
2036
			pax_attribute_schily_xattr(entry, key, value,
2513
						/* Truncated archive */
2037
			    value_length);
2514
						archive_set_error(&a->archive, EINVAL,
2038
		} else if (strcmp(key, "SUN.holesdata") == 0) {
2515
								  "Truncated archive"
2039
			/* A Solaris extension for sparse. */
2516
								  " detected while reading SCHILY.fflags");
2040
			r = solaris_sparse_parse(a, tar, entry, value);
2517
						return (ARCHIVE_FATAL);
2041
			if (r < err) {
2518
					}
2042
				if (r == ARCHIVE_FATAL)
2519
					archive_entry_copy_fflags_text_len(entry, p, value_length);
2043
					return (r);
2520
					err = ARCHIVE_OK;
2044
				err = r;
2521
				} else {
2045
				archive_set_error(&a->archive,
2522
					/* Overlong fflags field */
2046
				    ARCHIVE_ERRNO_MISC,
2523
					err = ARCHIVE_WARN;
2047
				    "Parse error: SUN.holesdata");
2524
				}
2525
				__archive_read_consume(a, value_length);
2526
				return (err);
2527
			}
2528
			else if (key_length == 3 && memcmp(key, "dev", 3) == 0) {
2529
				if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2530
					archive_entry_set_dev(entry, (dev_t)t);
2531
				}
2532
				return (err);
2533
			}
2534
			else if (key_length == 3 && memcmp(key, "ino", 3) == 0) {
2535
				if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2536
					archive_entry_set_ino(entry, t);
2537
				}
2538
				return (err);
2539
			}
2540
			else if (key_length == 5 && memcmp(key, "nlink", 5) == 0) {
2541
				if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2542
					archive_entry_set_nlink(entry, (unsigned int)t);
2543
				}
2544
				return (err);
2545
			}
2546
			else if (key_length == 8 && memcmp(key, "realsize", 8) == 0) {
2547
				if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2548
					tar->realsize = t;
2549
					tar->realsize_override = 1;
2550
					archive_entry_set_size(entry, tar->realsize);
2551
				}
2552
				return (err);
2553
			}
2554
			else if (key_length > 6 && memcmp(key, "xattr.", 6) == 0) {
2555
				key_length -= 6;
2556
				key += 6;
2557
				if (value_length < xattr_limit) {
2558
					p = __archive_read_ahead(a, value_length, &bytes_read);
2559
					if (p == NULL) {
2560
						archive_set_error(&a->archive, EINVAL,
2561
								  "Truncated archive"
2562
								  " detected while reading SCHILY.xattr");
2563
						return (ARCHIVE_FATAL);
2564
					}
2565
					if (pax_attribute_SCHILY_xattr(entry, key, key_length, p, value_length)) {
2566
						/* TODO: Unable to parse xattr */
2567
						err = ARCHIVE_WARN;
2568
					}
2569
				} else {
2570
					archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2571
							  "Unreasonably large xattr: %d > %d",
2572
							  (int)value_length, (int)xattr_limit);
2573
					err = ARCHIVE_WARN;
2574
				}
2575
				__archive_read_consume(a, value_length);
2576
				return (err);
2577
			}
2578
		}
2579
		/* SUN.* extensions from Solaris tar */
2580
		if (key_length > 4 && memcmp(key, "SUN.", 4) == 0) {
2581
			key_length -= 4;
2582
			key += 4;
2583
2584
			if (key_length == 9 && memcmp(key, "holesdata", 9) == 0) {
2585
				/* SUN.holesdata */
2586
				if (value_length < sparse_map_limit) {
2587
					p = __archive_read_ahead(a, value_length, &bytes_read);
2588
					if (p == NULL) {
2589
						archive_set_error(&a->archive, EINVAL,
2590
								  "Truncated archive"
2591
								  " detected while reading SUN.holesdata");
2592
						return (ARCHIVE_FATAL);
2593
					}
2594
					err = pax_attribute_SUN_holesdata(a, tar, entry, p, value_length);
2595
					if (err < ARCHIVE_OK) {
2596
						archive_set_error(&a->archive,
2597
								  ARCHIVE_ERRNO_MISC,
2598
								  "Parse error: SUN.holesdata");
2599
					}
2600
				} else {
2601
					archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
2602
							  "Unreasonably large sparse map: %d > %d",
2603
							  (int)value_length, (int)sparse_map_limit);
2604
					err = ARCHIVE_FAILED;
2605
				}
2606
				__archive_read_consume(a, value_length);
2607
				return (err);
2048
			}
2608
			}
2049
		}
2609
		}
2050
		break;
2610
		break;
2051
	case 'a':
2611
	case 'a':
2052
		if (strcmp(key, "atime") == 0) {
2612
		if (key_length == 5 && memcmp(key, "atime", 5) == 0) {
2053
			pax_time(value, &s, &n);
2613
			if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
2054
			archive_entry_set_atime(entry, s, n);
2614
				archive_entry_set_atime(entry, t, n);
2615
			}
2616
			return (err);
2055
		}
2617
		}
2056
		break;
2618
		break;
2057
	case 'c':
2619
	case 'c':
2058
		if (strcmp(key, "ctime") == 0) {
2620
		if (key_length == 5 && memcmp(key, "ctime", 5) == 0) {
2059
			pax_time(value, &s, &n);
2621
			if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
2060
			archive_entry_set_ctime(entry, s, n);
2622
				archive_entry_set_ctime(entry, t, n);
2061
		} else if (strcmp(key, "charset") == 0) {
2623
			}
2624
			return (err);
2625
		} else if (key_length == 7 && memcmp(key, "charset", 7) == 0) {
2062
			/* TODO: Publish charset information in entry. */
2626
			/* TODO: Publish charset information in entry. */
2063
		} else if (strcmp(key, "comment") == 0) {
2627
		} else if (key_length == 7 && memcmp(key, "comment", 7) == 0) {
2064
			/* TODO: Publish comment in entry. */
2628
			/* TODO: Publish comment in entry. */
2065
		}
2629
		}
2066
		break;
2630
		break;
2067
	case 'g':
2631
	case 'g':
2068
		if (strcmp(key, "gid") == 0) {
2632
		if (key_length == 3 && memcmp(key, "gid", 3) == 0) {
2069
			archive_entry_set_gid(entry,
2633
			if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2070
			    tar_atol10(value, strlen(value)));
2634
				archive_entry_set_gid(entry, t);
2071
		} else if (strcmp(key, "gname") == 0) {
2635
			}
2072
			archive_strcpy(&(tar->entry_gname), value);
2636
			return (err);
2637
		} else if (key_length == 5 && memcmp(key, "gname", 5) == 0) {
2638
			if (value_length > guname_limit) {
2639
				*unconsumed += value_length;
2640
				err = ARCHIVE_WARN;
2641
			} else {
2642
				err = read_bytes_to_string(a, &(tar->entry_gname), value_length, unconsumed);
2643
			}
2644
			return (err);
2073
		}
2645
		}
2074
		break;
2646
		break;
2075
	case 'h':
2647
	case 'h':
2076
		if (strcmp(key, "hdrcharset") == 0) {
2648
		if (key_length == 10 && memcmp(key, "hdrcharset", 10) == 0) {
2077
			if (strcmp(value, "BINARY") == 0)
2649
			if (value_length < 64) {
2078
				/* Binary  mode. */
2650
				p = __archive_read_ahead(a, value_length, &bytes_read);
2079
				tar->pax_hdrcharset_binary = 1;
2651
				if (p == NULL) {
2080
			else if (strcmp(value, "ISO-IR 10646 2000 UTF-8") == 0)
2652
					archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2081
				tar->pax_hdrcharset_binary = 0;
2653
							  "Truncated tar archive "
2654
							  "detected while reading hdrcharset attribute");
2655
					return (ARCHIVE_FATAL);
2656
				}
2657
				if (value_length == 6
2658
				    && memcmp(p, "BINARY", 6) == 0) {
2659
					/* Binary  mode. */
2660
					tar->pax_hdrcharset_utf8 = 0;
2661
					err = ARCHIVE_OK;
2662
				} else if (value_length == 23
2663
					   && memcmp(p, "ISO-IR 10646 2000 UTF-8", 23) == 0) {
2664
					tar->pax_hdrcharset_utf8 = 1;
2665
					err = ARCHIVE_OK;
2666
				} else {
2667
					/* TODO: Unrecognized character set */
2668
					err  = ARCHIVE_WARN;
2669
				}
2670
			} else {
2671
				archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2672
						  "hdrcharset attribute is unreasonably large (%d bytes)",
2673
						  (int)value_length);
2674
				err = ARCHIVE_WARN;
2675
			}
2676
			__archive_read_consume(a, value_length);
2677
			return (err);
2082
		}
2678
		}
2083
		break;
2679
		break;
2084
	case 'l':
2680
	case 'l':
2085
		/* pax interchange doesn't distinguish hardlink vs. symlink. */
2681
		/* pax interchange doesn't distinguish hardlink vs. symlink. */
2086
		if (strcmp(key, "linkpath") == 0) {
2682
		if (key_length == 8 && memcmp(key, "linkpath", 8) == 0) {
2087
			archive_strcpy(&(tar->entry_linkpath), value);
2683
			if (value_length > pathname_limit) {
2684
				*unconsumed += value_length;
2685
				err = ARCHIVE_WARN;
2686
			} else {
2687
				err = read_bytes_to_string(a, &tar->entry_linkpath, value_length, unconsumed);
2688
			}
2689
			return (err);
2088
		}
2690
		}
2089
		break;
2691
		break;
2090
	case 'm':
2692
	case 'm':
2091
		if (strcmp(key, "mtime") == 0) {
2693
		if (key_length == 5 && memcmp(key, "mtime", 5) == 0) {
2092
			pax_time(value, &s, &n);
2694
			if ((err = pax_attribute_read_time(a, value_length, &t, &n, unconsumed)) == ARCHIVE_OK) {
2093
			archive_entry_set_mtime(entry, s, n);
2695
				archive_entry_set_mtime(entry, t, n);
2696
			}
2697
			return (err);
2094
		}
2698
		}
2095
		break;
2699
		break;
2096
	case 'p':
2700
	case 'p':
2097
		if (strcmp(key, "path") == 0) {
2701
		if (key_length == 4 && memcmp(key, "path", 4) == 0) {
2098
			archive_strcpy(&(tar->entry_pathname), value);
2702
			if (value_length > pathname_limit) {
2703
				*unconsumed += value_length;
2704
				err = ARCHIVE_WARN;
2705
			} else {
2706
				err = read_bytes_to_string(a, &(tar->entry_pathname), value_length, unconsumed);
2707
			}
2708
			return (err);
2099
		}
2709
		}
2100
		break;
2710
		break;
2101
	case 'r':
2711
	case 'r':
Lines 2104-2151 pax_attribute(struct archive_read *a, struct tar *tar, Link Here
2104
	case 's':
2714
	case 's':
2105
		/* POSIX has reserved 'security.*' */
2715
		/* POSIX has reserved 'security.*' */
2106
		/* Someday: if (strcmp(key, "security.acl") == 0) { ... } */
2716
		/* Someday: if (strcmp(key, "security.acl") == 0) { ... } */
2107
		if (strcmp(key, "size") == 0) {
2717
		if (key_length == 4 && memcmp(key, "size", 4) == 0) {
2108
			/* "size" is the size of the data in the entry. */
2718
			/* "size" is the size of the data in the entry. */
2109
			tar->entry_bytes_remaining
2719
			if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2110
			    = tar_atol10(value, strlen(value));
2720
				tar->entry_bytes_remaining = t;
2111
			if (tar->entry_bytes_remaining < 0) {
2721
				/*
2112
				tar->entry_bytes_remaining = 0;
2722
				 * The "size" pax header keyword always overrides the
2113
				archive_set_error(&a->archive,
2723
				 * "size" field in the tar header.
2114
				    ARCHIVE_ERRNO_MISC,
2724
				 * GNU.sparse.realsize, GNU.sparse.size and
2115
				    "Tar size attribute is negative");
2725
				 * SCHILY.realsize override this value.
2116
				return (ARCHIVE_FATAL);
2726
				 */
2727
				if (!tar->realsize_override) {
2728
					archive_entry_set_size(entry,
2729
							       tar->entry_bytes_remaining);
2730
					tar->realsize
2731
						= tar->entry_bytes_remaining;
2732
				}
2117
			}
2733
			}
2118
			if (tar->entry_bytes_remaining == INT64_MAX) {
2734
			else if (t == INT64_MAX) {
2119
				/* Note: tar_atol returns INT64_MAX on overflow */
2735
				/* Note: pax_attr_read_number returns INT64_MAX on overflow or < 0 */
2120
				tar->entry_bytes_remaining = 0;
2736
				tar->entry_bytes_remaining = 0;
2121
				archive_set_error(&a->archive,
2737
				archive_set_error(&a->archive,
2122
				    ARCHIVE_ERRNO_MISC,
2738
				    ARCHIVE_ERRNO_MISC,
2123
				    "Tar size attribute overflow");
2739
				    "Tar size attribute overflow");
2124
				return (ARCHIVE_FATAL);
2740
				return (ARCHIVE_FATAL);
2125
			}
2741
			}
2126
			/*
2742
			return (err);
2127
			 * The "size" pax header keyword always overrides the
2128
			 * "size" field in the tar header.
2129
			 * GNU.sparse.realsize, GNU.sparse.size and
2130
			 * SCHILY.realsize override this value.
2131
			 */
2132
			if (!tar->realsize_override) {
2133
				archive_entry_set_size(entry,
2134
				    tar->entry_bytes_remaining);
2135
				tar->realsize
2136
				    = tar->entry_bytes_remaining;
2137
			}
2138
		}
2743
		}
2139
		break;
2744
		break;
2140
	case 'u':
2745
	case 'u':
2141
		if (strcmp(key, "uid") == 0) {
2746
		if (key_length == 3 && memcmp(key, "uid", 3) == 0) {
2142
			archive_entry_set_uid(entry,
2747
			if ((err = pax_attribute_read_number(a, value_length, &t)) == ARCHIVE_OK) {
2143
			    tar_atol10(value, strlen(value)));
2748
				archive_entry_set_uid(entry, t);
2144
		} else if (strcmp(key, "uname") == 0) {
2749
			}
2145
			archive_strcpy(&(tar->entry_uname), value);
2750
			return (err);
2751
		} else if (key_length == 5 && memcmp(key, "uname", 5) == 0) {
2752
			if (value_length > guname_limit) {
2753
				*unconsumed += value_length;
2754
				err = ARCHIVE_WARN;
2755
			} else {
2756
				err = read_bytes_to_string(a, &(tar->entry_uname), value_length, unconsumed);
2757
			}
2758
			return (err);
2146
		}
2759
		}
2147
		break;
2760
		break;
2148
	}
2761
	}
2762
2763
	/* Unrecognized key, just skip the entire value. */
2764
	__archive_read_consume(a, value_length);
2149
	return (err);
2765
	return (err);
2150
}
2766
}
2151
2767
Lines 2155-2161 pax_attribute(struct archive_read *a, struct tar *tar, Link Here
2155
 * parse a decimal time value, which may include a fractional portion
2771
 * parse a decimal time value, which may include a fractional portion
2156
 */
2772
 */
2157
static void
2773
static void
2158
pax_time(const char *p, int64_t *ps, long *pn)
2774
pax_time(const char *p, size_t length, int64_t *ps, long *pn)
2159
{
2775
{
2160
	char digit;
2776
	char digit;
2161
	int64_t	s;
2777
	int64_t	s;
Lines 2166-2178 pax_time(const char *p, int64_t *ps, long *pn) Link Here
2166
	limit = INT64_MAX / 10;
2782
	limit = INT64_MAX / 10;
2167
	last_digit_limit = INT64_MAX % 10;
2783
	last_digit_limit = INT64_MAX % 10;
2168
2784
2785
	if (length <= 0) {
2786
		*ps = 0;
2787
		return;
2788
	}
2169
	s = 0;
2789
	s = 0;
2170
	sign = 1;
2790
	sign = 1;
2171
	if (*p == '-') {
2791
	if (*p == '-') {
2172
		sign = -1;
2792
		sign = -1;
2173
		p++;
2793
		p++;
2794
		length--;
2174
	}
2795
	}
2175
	while (*p >= '0' && *p <= '9') {
2796
	while (length > 0 && *p >= '0' && *p <= '9') {
2176
		digit = *p - '0';
2797
		digit = *p - '0';
2177
		if (s > limit ||
2798
		if (s > limit ||
2178
		    (s == limit && digit > last_digit_limit)) {
2799
		    (s == limit && digit > last_digit_limit)) {
Lines 2181-2186 pax_time(const char *p, int64_t *ps, long *pn) Link Here
2181
		}
2802
		}
2182
		s = (s * 10) + digit;
2803
		s = (s * 10) + digit;
2183
		++p;
2804
		++p;
2805
		--length;
2184
	}
2806
	}
2185
2807
2186
	*ps = s * sign;
2808
	*ps = s * sign;
Lines 2188-2200 pax_time(const char *p, int64_t *ps, long *pn) Link Here
2188
	/* Calculate nanoseconds. */
2810
	/* Calculate nanoseconds. */
2189
	*pn = 0;
2811
	*pn = 0;
2190
2812
2191
	if (*p != '.')
2813
	if (length <= 0 || *p != '.')
2192
		return;
2814
		return;
2193
2815
2194
	l = 100000000UL;
2816
	l = 100000000UL;
2195
	do {
2817
	do {
2196
		++p;
2818
		++p;
2197
		if (*p >= '0' && *p <= '9')
2819
		--length;
2820
		if (length > 0 && *p >= '0' && *p <= '9')
2198
			*pn += (*p - '0') * l;
2821
			*pn += (*p - '0') * l;
2199
		else
2822
		else
2200
			break;
2823
			break;
Lines 2225-2273 header_gnutar(struct archive_read *a, struct tar *tar, Link Here
2225
2848
2226
	/* Copy filename over (to ensure null termination). */
2849
	/* Copy filename over (to ensure null termination). */
2227
	header = (const struct archive_entry_header_gnutar *)h;
2850
	header = (const struct archive_entry_header_gnutar *)h;
2228
	if (archive_entry_copy_pathname_l(entry,
2851
	const char *existing_pathname = archive_entry_pathname(entry);
2229
	    header->name, sizeof(header->name), tar->sconv) != 0) {
2852
	if (existing_pathname == NULL || existing_pathname[0] == '\0') {
2230
		err = set_conversion_failed_error(a, tar->sconv, "Pathname");
2853
		if (archive_entry_copy_pathname_l(entry,
2231
		if (err == ARCHIVE_FATAL)
2854
		    header->name, sizeof(header->name), tar->sconv) != 0) {
2232
			return (err);
2855
			err = set_conversion_failed_error(a, tar->sconv, "Pathname");
2856
			if (err == ARCHIVE_FATAL)
2857
				return (err);
2858
		}
2233
	}
2859
	}
2234
2860
2235
	/* Fields common to ustar and GNU */
2861
	/* Fields common to ustar and GNU */
2236
	/* XXX Can the following be factored out since it's common
2862
	/* XXX Can the following be factored out since it's common
2237
	 * to ustar and gnu tar?  Is it okay to move it down into
2863
	 * to ustar and gnu tar?  Is it okay to move it down into
2238
	 * header_common, perhaps?  */
2864
	 * header_common, perhaps?  */
2239
	if (archive_entry_copy_uname_l(entry,
2865
	const char *existing_uname = archive_entry_uname(entry);
2240
	    header->uname, sizeof(header->uname), tar->sconv) != 0) {
2866
	if (existing_uname == NULL || existing_uname[0] == '\0') {
2241
		err = set_conversion_failed_error(a, tar->sconv, "Uname");
2867
		if (archive_entry_copy_uname_l(entry,
2242
		if (err == ARCHIVE_FATAL)
2868
		    header->uname, sizeof(header->uname), tar->sconv) != 0) {
2243
			return (err);
2869
			err = set_conversion_failed_error(a, tar->sconv, "Uname");
2870
			if (err == ARCHIVE_FATAL)
2871
				return (err);
2872
		}
2244
	}
2873
	}
2245
2874
2246
	if (archive_entry_copy_gname_l(entry,
2875
	const char *existing_gname = archive_entry_gname(entry);
2247
	    header->gname, sizeof(header->gname), tar->sconv) != 0) {
2876
	if (existing_gname == NULL || existing_gname[0] == '\0') {
2248
		err = set_conversion_failed_error(a, tar->sconv, "Gname");
2877
		if (archive_entry_copy_gname_l(entry,
2249
		if (err == ARCHIVE_FATAL)
2878
		    header->gname, sizeof(header->gname), tar->sconv) != 0) {
2250
			return (err);
2879
			err = set_conversion_failed_error(a, tar->sconv, "Gname");
2880
			if (err == ARCHIVE_FATAL)
2881
				return (err);
2882
		}
2251
	}
2883
	}
2252
2884
2253
	/* Parse out device numbers only for char and block specials */
2885
	/* Parse out device numbers only for char and block specials */
2254
	if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
2886
	if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
2255
		archive_entry_set_rdevmajor(entry, (dev_t)
2887
		if (!archive_entry_rdev_is_set(entry)) {
2256
		    tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
2888
			archive_entry_set_rdevmajor(entry, (dev_t)
2257
		archive_entry_set_rdevminor(entry, (dev_t)
2889
			    tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
2258
		    tar_atol(header->rdevminor, sizeof(header->rdevminor)));
2890
			archive_entry_set_rdevminor(entry, (dev_t)
2259
	} else
2891
			    tar_atol(header->rdevminor, sizeof(header->rdevminor)));
2892
		}
2893
	} else {
2260
		archive_entry_set_rdev(entry, 0);
2894
		archive_entry_set_rdev(entry, 0);
2895
	}
2261
2896
2262
	tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
2897
	tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
2263
2898
2264
	/* Grab GNU-specific fields. */
2899
	/* Grab GNU-specific fields. */
2265
	t = tar_atol(header->atime, sizeof(header->atime));
2900
	if (!archive_entry_atime_is_set(entry)) {
2266
	if (t > 0)
2901
		t = tar_atol(header->atime, sizeof(header->atime));
2267
		archive_entry_set_atime(entry, t, 0);
2902
		if (t > 0)
2268
	t = tar_atol(header->ctime, sizeof(header->ctime));
2903
			archive_entry_set_atime(entry, t, 0);
2269
	if (t > 0)
2904
	}
2270
		archive_entry_set_ctime(entry, t, 0);
2905
	if (!archive_entry_ctime_is_set(entry)) {
2906
		t = tar_atol(header->ctime, sizeof(header->ctime));
2907
		if (t > 0)
2908
			archive_entry_set_ctime(entry, t, 0);
2909
	}
2271
2910
2272
	if (header->realsize[0] != 0) {
2911
	if (header->realsize[0] != 0) {
2273
		tar->realsize
2912
		tar->realsize
Lines 2295-2301 gnu_add_sparse_entry(struct archive_read *a, struct tar *tar, Link Here
2295
{
2934
{
2296
	struct sparse_block *p;
2935
	struct sparse_block *p;
2297
2936
2298
	p = (struct sparse_block *)calloc(1, sizeof(*p));
2937
	p = calloc(1, sizeof(*p));
2299
	if (p == NULL) {
2938
	if (p == NULL) {
2300
		archive_set_error(&a->archive, ENOMEM, "Out of memory");
2939
		archive_set_error(&a->archive, ENOMEM, "Out of memory");
2301
		return (ARCHIVE_FATAL);
2940
		return (ARCHIVE_FATAL);
Lines 2360-2368 gnu_sparse_old_read(struct archive_read *a, struct tar *tar, Link Here
2360
	do {
2999
	do {
2361
		tar_flush_unconsumed(a, unconsumed);
3000
		tar_flush_unconsumed(a, unconsumed);
2362
		data = __archive_read_ahead(a, 512, &bytes_read);
3001
		data = __archive_read_ahead(a, 512, &bytes_read);
2363
		if (bytes_read < 0)
3002
		if (data == NULL) {
2364
			return (ARCHIVE_FATAL);
2365
		if (bytes_read < 512) {
2366
			archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
3003
			archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
2367
			    "Truncated tar archive "
3004
			    "Truncated tar archive "
2368
			    "detected while reading sparse file data");
3005
			    "detected while reading sparse file data");
Lines 2419-2437 gnu_sparse_old_parse(struct archive_read *a, struct tar *tar, Link Here
2419
 * importantly, the sparse data was lost when extracted by archivers
3056
 * importantly, the sparse data was lost when extracted by archivers
2420
 * that didn't recognize this extension.
3057
 * that didn't recognize this extension.
2421
 */
3058
 */
2422
2423
static int
3059
static int
2424
gnu_sparse_01_parse(struct archive_read *a, struct tar *tar, const char *p)
3060
gnu_sparse_01_parse(struct archive_read *a, struct tar *tar, const char *p, size_t length)
2425
{
3061
{
2426
	const char *e;
3062
	const char *e;
2427
	int64_t offset = -1, size = -1;
3063
	int64_t offset = -1, size = -1;
2428
3064
2429
	for (;;) {
3065
	for (;;) {
2430
		e = p;
3066
		e = p;
2431
		while (*e != '\0' && *e != ',') {
3067
		while (length > 0 && *e != ',') {
2432
			if (*e < '0' || *e > '9')
3068
			if (*e < '0' || *e > '9')
2433
				return (ARCHIVE_WARN);
3069
				return (ARCHIVE_WARN);
2434
			e++;
3070
			e++;
3071
			length--;
2435
		}
3072
		}
2436
		if (offset < 0) {
3073
		if (offset < 0) {
2437
			offset = tar_atol10(p, e - p);
3074
			offset = tar_atol10(p, e - p);
Lines 2446-2454 gnu_sparse_01_parse(struct archive_read *a, struct tar *tar, const char *p) Link Here
2446
				return (ARCHIVE_FATAL);
3083
				return (ARCHIVE_FATAL);
2447
			offset = -1;
3084
			offset = -1;
2448
		}
3085
		}
2449
		if (*e == '\0')
3086
		if (length == 0)
2450
			return (ARCHIVE_OK);
3087
			return (ARCHIVE_OK);
2451
		p = e + 1;
3088
		p = e + 1;
3089
		length--;
2452
	}
3090
	}
2453
}
3091
}
2454
3092
Lines 2570-2577 gnu_sparse_10_read(struct archive_read *a, struct tar *tar, size_t *unconsumed) Link Here
2570
 * consist of both data and hole.
3208
 * consist of both data and hole.
2571
 */
3209
 */
2572
static int
3210
static int
2573
solaris_sparse_parse(struct archive_read *a, struct tar *tar,
3211
pax_attribute_SUN_holesdata(struct archive_read *a, struct tar *tar,
2574
    struct archive_entry *entry, const char *p)
3212
	struct archive_entry *entry, const char *p, size_t length)
2575
{
3213
{
2576
	const char *e;
3214
	const char *e;
2577
	int64_t start, end;
3215
	int64_t start, end;
Lines 2580-2595 solaris_sparse_parse(struct archive_read *a, struct tar *tar, Link Here
2580
	(void)entry; /* UNUSED */
3218
	(void)entry; /* UNUSED */
2581
3219
2582
	end = 0;
3220
	end = 0;
2583
	if (*p == ' ')
3221
	if (length <= 0)
3222
		return (ARCHIVE_WARN);
3223
	if (*p == ' ') {
2584
		p++;
3224
		p++;
2585
	else
3225
		length--;
3226
	} else {
2586
		return (ARCHIVE_WARN);
3227
		return (ARCHIVE_WARN);
3228
	}
2587
	for (;;) {
3229
	for (;;) {
2588
		e = p;
3230
		e = p;
2589
		while (*e != '\0' && *e != ' ') {
3231
		while (length > 0 && *e != ' ') {
2590
			if (*e < '0' || *e > '9')
3232
			if (*e < '0' || *e > '9')
2591
				return (ARCHIVE_WARN);
3233
				return (ARCHIVE_WARN);
2592
			e++;
3234
			e++;
3235
			length--;
2593
		}
3236
		}
2594
		start = end;
3237
		start = end;
2595
		end = tar_atol10(p, e - p);
3238
		end = tar_atol10(p, e - p);
Lines 2601-2609 solaris_sparse_parse(struct archive_read *a, struct tar *tar, Link Here
2601
				return (ARCHIVE_FATAL);
3244
				return (ARCHIVE_FATAL);
2602
			tar->sparse_last->hole = hole;
3245
			tar->sparse_last->hole = hole;
2603
		}
3246
		}
2604
		if (*e == '\0')
3247
		if (length == 0 || *e == '\n') {
2605
			return (ARCHIVE_OK);
3248
			if (length == 0 && *e == '\n') {
3249
				return (ARCHIVE_OK);
3250
			} else {
3251
				return (ARCHIVE_WARN);
3252
			}
3253
		}
2606
		p = e + 1;
3254
		p = e + 1;
3255
		length--;
2607
		hole = hole == 0;
3256
		hole = hole == 0;
2608
	}
3257
	}
2609
}
3258
}
Lines 2770-2776 readline(struct archive_read *a, struct tar *tar, const char **start, Link Here
2770
	tar_flush_unconsumed(a, unconsumed);
3419
	tar_flush_unconsumed(a, unconsumed);
2771
3420
2772
	t = __archive_read_ahead(a, 1, &bytes_read);
3421
	t = __archive_read_ahead(a, 1, &bytes_read);
2773
	if (bytes_read <= 0)
3422
	if (bytes_read <= 0 || t == NULL)
2774
		return (ARCHIVE_FATAL);
3423
		return (ARCHIVE_FATAL);
2775
	s = t;  /* Start of line? */
3424
	s = t;  /* Start of line? */
2776
	p = memchr(t, '\n', bytes_read);
3425
	p = memchr(t, '\n', bytes_read);
Lines 2811-2817 readline(struct archive_read *a, struct tar *tar, const char **start, Link Here
2811
		}
3460
		}
2812
		/* Read some more. */
3461
		/* Read some more. */
2813
		t = __archive_read_ahead(a, 1, &bytes_read);
3462
		t = __archive_read_ahead(a, 1, &bytes_read);
2814
		if (bytes_read <= 0)
3463
		if (bytes_read <= 0 || t == NULL)
2815
			return (ARCHIVE_FATAL);
3464
			return (ARCHIVE_FATAL);
2816
		s = t;  /* Start of line? */
3465
		s = t;  /* Start of line? */
2817
		p = memchr(t, '\n', bytes_read);
3466
		p = memchr(t, '\n', bytes_read);
Lines 2855-2861 base64_decode(const char *s, size_t len, size_t *out_len) Link Here
2855
3504
2856
	/* Allocate enough space to hold the entire output. */
3505
	/* Allocate enough space to hold the entire output. */
2857
	/* Note that we may not use all of this... */
3506
	/* Note that we may not use all of this... */
2858
	out = (char *)malloc(len - len / 4 + 1);
3507
	out = malloc(len - len / 4 + 1);
2859
	if (out == NULL) {
3508
	if (out == NULL) {
2860
		*out_len = 0;
3509
		*out_len = 0;
2861
		return (NULL);
3510
		return (NULL);
Lines 2905-2926 base64_decode(const char *s, size_t len, size_t *out_len) Link Here
2905
}
3554
}
2906
3555
2907
static char *
3556
static char *
2908
url_decode(const char *in)
3557
url_decode(const char *in, size_t length)
2909
{
3558
{
2910
	char *out, *d;
3559
	char *out, *d;
2911
	const char *s;
3560
	const char *s;
2912
3561
2913
	out = (char *)malloc(strlen(in) + 1);
3562
	out = malloc(length + 1);
2914
	if (out == NULL)
3563
	if (out == NULL)
2915
		return (NULL);
3564
		return (NULL);
2916
	for (s = in, d = out; *s != '\0'; ) {
3565
	for (s = in, d = out; length > 0 && *s != '\0'; ) {
2917
		if (s[0] == '%' && s[1] != '\0' && s[2] != '\0') {
3566
		if (s[0] == '%' && length > 2) {
2918
			/* Try to convert % escape */
3567
			/* Try to convert % escape */
2919
			int digit1 = tohex(s[1]);
3568
			int digit1 = tohex(s[1]);
2920
			int digit2 = tohex(s[2]);
3569
			int digit2 = tohex(s[2]);
2921
			if (digit1 >= 0 && digit2 >= 0) {
3570
			if (digit1 >= 0 && digit2 >= 0) {
2922
				/* Looks good, consume three chars */
3571
				/* Looks good, consume three chars */
2923
				s += 3;
3572
				s += 3;
3573
				length -= 3;
2924
				/* Convert output */
3574
				/* Convert output */
2925
				*d++ = ((digit1 << 4) | digit2);
3575
				*d++ = ((digit1 << 4) | digit2);
2926
				continue;
3576
				continue;
Lines 2928-2933 url_decode(const char *in) Link Here
2928
			/* Else fall through and treat '%' as normal char */
3578
			/* Else fall through and treat '%' as normal char */
2929
		}
3579
		}
2930
		*d++ = *s++;
3580
		*d++ = *s++;
3581
		--length;
2931
	}
3582
	}
2932
	*d = '\0';
3583
	*d = '\0';
2933
	return (out);
3584
	return (out);
(-)b/contrib/libarchive/libarchive/archive_read_support_format_xar.c (-12 / +20 lines)
Lines 416-422 static void unknowntag_end(struct xar *, const char *); Link Here
416
static int	xml_start(struct archive_read *,
416
static int	xml_start(struct archive_read *,
417
    const char *, struct xmlattr_list *);
417
    const char *, struct xmlattr_list *);
418
static void	xml_end(void *, const char *);
418
static void	xml_end(void *, const char *);
419
static void	xml_data(void *, const char *, int);
419
static void	xml_data(void *, const char *, size_t);
420
static int	xml_parse_file_flags(struct xar *, const char *);
420
static int	xml_parse_file_flags(struct xar *, const char *);
421
static int	xml_parse_file_ext2(struct xar *, const char *);
421
static int	xml_parse_file_ext2(struct xar *, const char *);
422
#if defined(HAVE_LIBXML_XMLREADER_H)
422
#if defined(HAVE_LIBXML_XMLREADER_H)
Lines 450-456 archive_read_support_format_xar(struct archive *_a) Link Here
450
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
450
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
451
	    ARCHIVE_STATE_NEW, "archive_read_support_format_xar");
451
	    ARCHIVE_STATE_NEW, "archive_read_support_format_xar");
452
452
453
	xar = (struct xar *)calloc(1, sizeof(*xar));
453
	xar = calloc(1, sizeof(*xar));
454
	if (xar == NULL) {
454
	if (xar == NULL) {
455
		archive_set_error(&a->archive, ENOMEM,
455
		archive_set_error(&a->archive, ENOMEM,
456
		    "Can't allocate xar data");
456
		    "Can't allocate xar data");
Lines 1242-1248 heap_add_entry(struct archive_read *a, Link Here
1242
			return (ARCHIVE_FATAL);
1242
			return (ARCHIVE_FATAL);
1243
		}
1243
		}
1244
		new_pending_files = (struct xar_file **)
1244
		new_pending_files = (struct xar_file **)
1245
		    malloc(new_size * sizeof(new_pending_files[0]));
1245
		    calloc(new_size, sizeof(new_pending_files[0]));
1246
		if (new_pending_files == NULL) {
1246
		if (new_pending_files == NULL) {
1247
			archive_set_error(&a->archive,
1247
			archive_set_error(&a->archive,
1248
			    ENOMEM, "Out of memory");
1248
			    ENOMEM, "Out of memory");
Lines 1616-1624 decompress(struct archive_read *a, const void **buff, size_t *outbytes, Link Here
1616
	switch (xar->rd_encoding) {
1616
	switch (xar->rd_encoding) {
1617
	case GZIP:
1617
	case GZIP:
1618
		xar->stream.next_in = (Bytef *)(uintptr_t)b;
1618
		xar->stream.next_in = (Bytef *)(uintptr_t)b;
1619
		xar->stream.avail_in = avail_in;
1619
		xar->stream.avail_in = (uInt)avail_in;
1620
		xar->stream.next_out = (unsigned char *)outbuff;
1620
		xar->stream.next_out = (unsigned char *)outbuff;
1621
		xar->stream.avail_out = avail_out;
1621
		xar->stream.avail_out = (uInt)avail_out;
1622
		r = inflate(&(xar->stream), 0);
1622
		r = inflate(&(xar->stream), 0);
1623
		switch (r) {
1623
		switch (r) {
1624
		case Z_OK: /* Decompressor made some progress.*/
1624
		case Z_OK: /* Decompressor made some progress.*/
Lines 1635-1643 decompress(struct archive_read *a, const void **buff, size_t *outbytes, Link Here
1635
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
1635
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
1636
	case BZIP2:
1636
	case BZIP2:
1637
		xar->bzstream.next_in = (char *)(uintptr_t)b;
1637
		xar->bzstream.next_in = (char *)(uintptr_t)b;
1638
		xar->bzstream.avail_in = avail_in;
1638
		xar->bzstream.avail_in = (unsigned int)avail_in;
1639
		xar->bzstream.next_out = (char *)outbuff;
1639
		xar->bzstream.next_out = (char *)outbuff;
1640
		xar->bzstream.avail_out = avail_out;
1640
		xar->bzstream.avail_out = (unsigned int)avail_out;
1641
		r = BZ2_bzDecompress(&(xar->bzstream));
1641
		r = BZ2_bzDecompress(&(xar->bzstream));
1642
		switch (r) {
1642
		switch (r) {
1643
		case BZ_STREAM_END: /* Found end of stream. */
1643
		case BZ_STREAM_END: /* Found end of stream. */
Lines 2674-2680 is_string(const char *known, const char *data, size_t len) Link Here
2674
}
2674
}
2675
2675
2676
static void
2676
static void
2677
xml_data(void *userData, const char *s, int len)
2677
xml_data(void *userData, const char *s, size_t len)
2678
{
2678
{
2679
	struct archive_read *a;
2679
	struct archive_read *a;
2680
	struct xar *xar;
2680
	struct xar *xar;
Lines 2707-2712 xml_data(void *userData, const char *s, int len) Link Here
2707
2707
2708
	switch (xar->xmlsts) {
2708
	switch (xar->xmlsts) {
2709
	case FILE_NAME:
2709
	case FILE_NAME:
2710
		if (xar->file->has & HAS_PATHNAME)
2711
			break;
2712
2710
		if (xar->file->parent != NULL) {
2713
		if (xar->file->parent != NULL) {
2711
			archive_string_concat(&(xar->file->pathname),
2714
			archive_string_concat(&(xar->file->pathname),
2712
			    &(xar->file->parent->pathname));
2715
			    &(xar->file->parent->pathname));
Lines 3190-3197 xml2_read_toc(struct archive_read *a) Link Here
3190
			if (r == ARCHIVE_OK)
3193
			if (r == ARCHIVE_OK)
3191
				r = xml_start(a, name, &list);
3194
				r = xml_start(a, name, &list);
3192
			xmlattr_cleanup(&list);
3195
			xmlattr_cleanup(&list);
3193
			if (r != ARCHIVE_OK)
3196
			if (r != ARCHIVE_OK) {
3197
				xmlFreeTextReader(reader);
3198
				xmlCleanupParser();
3194
				return (r);
3199
				return (r);
3200
			}
3195
			if (empty)
3201
			if (empty)
3196
				xml_end(a, name);
3202
				xml_end(a, name);
3197
			break;
3203
			break;
Lines 3280-3286 expat_data_cb(void *userData, const XML_Char *s, int len) Link Here
3280
{
3286
{
3281
	struct expat_userData *ud = (struct expat_userData *)userData;
3287
	struct expat_userData *ud = (struct expat_userData *)userData;
3282
3288
3283
	xml_data(ud->archive, s, len);
3289
	xml_data(ud->archive, s, (size_t)len);
3284
}
3290
}
3285
3291
3286
static int
3292
static int
Lines 3316-3329 expat_read_toc(struct archive_read *a) Link Here
3316
3322
3317
		d = NULL;
3323
		d = NULL;
3318
		r = rd_contents(a, &d, &outbytes, &used, xar->toc_remaining);
3324
		r = rd_contents(a, &d, &outbytes, &used, xar->toc_remaining);
3319
		if (r != ARCHIVE_OK)
3325
		if (r != ARCHIVE_OK) {
3326
			XML_ParserFree(parser);
3320
			return (r);
3327
			return (r);
3328
		}
3321
		xar->toc_remaining -= used;
3329
		xar->toc_remaining -= used;
3322
		xar->offset += used;
3330
		xar->offset += used;
3323
		xar->toc_total += outbytes;
3331
		xar->toc_total += outbytes;
3324
		PRINT_TOC(d, outbytes);
3332
		PRINT_TOC(d, outbytes);
3325
3333
3326
		xr = XML_Parse(parser, d, outbytes, xar->toc_remaining == 0);
3334
		xr = XML_Parse(parser, d, (int)outbytes, xar->toc_remaining == 0);
3327
		__archive_read_consume(a, used);
3335
		__archive_read_consume(a, used);
3328
		if (xr == XML_STATUS_ERROR) {
3336
		if (xr == XML_STATUS_ERROR) {
3329
			XML_ParserFree(parser);
3337
			XML_ParserFree(parser);
(-)b/contrib/libarchive/libarchive/archive_read_support_format_zip.c (-25 / +20 lines)
Lines 1751-1758 zipx_xz_init(struct archive_read *a, struct zip *zip) Link Here
1751
	free(zip->uncompressed_buffer);
1751
	free(zip->uncompressed_buffer);
1752
1752
1753
	zip->uncompressed_buffer_size = 256 * 1024;
1753
	zip->uncompressed_buffer_size = 256 * 1024;
1754
	zip->uncompressed_buffer =
1754
	zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size);
1755
	    (uint8_t*) malloc(zip->uncompressed_buffer_size);
1756
	if (zip->uncompressed_buffer == NULL) {
1755
	if (zip->uncompressed_buffer == NULL) {
1757
		archive_set_error(&a->archive, ENOMEM,
1756
		archive_set_error(&a->archive, ENOMEM,
1758
		    "No memory for xz decompression");
1757
		    "No memory for xz decompression");
Lines 1862-1869 zipx_lzma_alone_init(struct archive_read *a, struct zip *zip) Link Here
1862
1861
1863
	if(!zip->uncompressed_buffer) {
1862
	if(!zip->uncompressed_buffer) {
1864
		zip->uncompressed_buffer_size = 256 * 1024;
1863
		zip->uncompressed_buffer_size = 256 * 1024;
1865
		zip->uncompressed_buffer =
1864
		zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size);
1866
			(uint8_t*) malloc(zip->uncompressed_buffer_size);
1867
1865
1868
		if (zip->uncompressed_buffer == NULL) {
1866
		if (zip->uncompressed_buffer == NULL) {
1869
			archive_set_error(&a->archive, ENOMEM,
1867
			archive_set_error(&a->archive, ENOMEM,
Lines 1924-1930 zip_read_data_zipx_xz(struct archive_read *a, const void **buff, Link Here
1924
		return (ARCHIVE_FATAL);
1922
		return (ARCHIVE_FATAL);
1925
	}
1923
	}
1926
1924
1927
	in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
1925
	in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
1928
	zip->zipx_lzma_stream.next_in = compressed_buf;
1926
	zip->zipx_lzma_stream.next_in = compressed_buf;
1929
	zip->zipx_lzma_stream.avail_in = in_bytes;
1927
	zip->zipx_lzma_stream.avail_in = in_bytes;
1930
	zip->zipx_lzma_stream.total_in = 0;
1928
	zip->zipx_lzma_stream.total_in = 0;
Lines 1966-1979 zip_read_data_zipx_xz(struct archive_read *a, const void **buff, Link Here
1966
			break;
1964
			break;
1967
	}
1965
	}
1968
1966
1969
	to_consume = zip->zipx_lzma_stream.total_in;
1967
	to_consume = (ssize_t)zip->zipx_lzma_stream.total_in;
1970
1968
1971
	__archive_read_consume(a, to_consume);
1969
	__archive_read_consume(a, to_consume);
1972
	zip->entry_bytes_remaining -= to_consume;
1970
	zip->entry_bytes_remaining -= to_consume;
1973
	zip->entry_compressed_bytes_read += to_consume;
1971
	zip->entry_compressed_bytes_read += to_consume;
1974
	zip->entry_uncompressed_bytes_read += zip->zipx_lzma_stream.total_out;
1972
	zip->entry_uncompressed_bytes_read += zip->zipx_lzma_stream.total_out;
1975
1973
1976
	*size = zip->zipx_lzma_stream.total_out;
1974
	*size = (size_t)zip->zipx_lzma_stream.total_out;
1977
	*buff = zip->uncompressed_buffer;
1975
	*buff = zip->uncompressed_buffer;
1978
1976
1979
	return (ARCHIVE_OK);
1977
	return (ARCHIVE_OK);
Lines 2014-2020 zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, Link Here
2014
	}
2012
	}
2015
2013
2016
	/* Set decompressor parameters. */
2014
	/* Set decompressor parameters. */
2017
	in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
2015
	in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
2018
2016
2019
	zip->zipx_lzma_stream.next_in = compressed_buf;
2017
	zip->zipx_lzma_stream.next_in = compressed_buf;
2020
	zip->zipx_lzma_stream.avail_in = in_bytes;
2018
	zip->zipx_lzma_stream.avail_in = in_bytes;
Lines 2024-2030 zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, Link Here
2024
		/* These lzma_alone streams lack end of stream marker, so let's
2022
		/* These lzma_alone streams lack end of stream marker, so let's
2025
		 * make sure the unpacker won't try to unpack more than it's
2023
		 * make sure the unpacker won't try to unpack more than it's
2026
		 * supposed to. */
2024
		 * supposed to. */
2027
		zipmin((int64_t) zip->uncompressed_buffer_size,
2025
		(size_t)zipmin((int64_t) zip->uncompressed_buffer_size,
2028
		    zip->entry->uncompressed_size -
2026
		    zip->entry->uncompressed_size -
2029
		    zip->entry_uncompressed_bytes_read);
2027
		    zip->entry_uncompressed_bytes_read);
2030
	zip->zipx_lzma_stream.total_out = 0;
2028
	zip->zipx_lzma_stream.total_out = 0;
Lines 2061-2067 zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, Link Here
2061
			return (ARCHIVE_FATAL);
2059
			return (ARCHIVE_FATAL);
2062
	}
2060
	}
2063
2061
2064
	to_consume = zip->zipx_lzma_stream.total_in;
2062
	to_consume = (ssize_t)zip->zipx_lzma_stream.total_in;
2065
2063
2066
	/* Update pointers. */
2064
	/* Update pointers. */
2067
	__archive_read_consume(a, to_consume);
2065
	__archive_read_consume(a, to_consume);
Lines 2082-2088 zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, Link Here
2082
	}
2080
	}
2083
2081
2084
	/* Return values. */
2082
	/* Return values. */
2085
	*size = zip->zipx_lzma_stream.total_out;
2083
	*size = (size_t)zip->zipx_lzma_stream.total_out;
2086
	*buff = zip->uncompressed_buffer;
2084
	*buff = zip->uncompressed_buffer;
2087
2085
2088
	/* If we're here, then we're good! */
2086
	/* If we're here, then we're good! */
Lines 2167-2174 zipx_ppmd8_init(struct archive_read *a, struct zip *zip) Link Here
2167
	free(zip->uncompressed_buffer);
2165
	free(zip->uncompressed_buffer);
2168
2166
2169
	zip->uncompressed_buffer_size = 256 * 1024;
2167
	zip->uncompressed_buffer_size = 256 * 1024;
2170
	zip->uncompressed_buffer =
2168
	zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size);
2171
	    (uint8_t*) malloc(zip->uncompressed_buffer_size);
2172
2169
2173
	if(zip->uncompressed_buffer == NULL) {
2170
	if(zip->uncompressed_buffer == NULL) {
2174
		archive_set_error(&a->archive, ENOMEM,
2171
		archive_set_error(&a->archive, ENOMEM,
Lines 2291-2298 zipx_bzip2_init(struct archive_read *a, struct zip *zip) Link Here
2291
	free(zip->uncompressed_buffer);
2288
	free(zip->uncompressed_buffer);
2292
2289
2293
	zip->uncompressed_buffer_size = 256 * 1024;
2290
	zip->uncompressed_buffer_size = 256 * 1024;
2294
	zip->uncompressed_buffer =
2291
	zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size);
2295
	    (uint8_t*) malloc(zip->uncompressed_buffer_size);
2296
	if (zip->uncompressed_buffer == NULL) {
2292
	if (zip->uncompressed_buffer == NULL) {
2297
		archive_set_error(&a->archive, ENOMEM,
2293
		archive_set_error(&a->archive, ENOMEM,
2298
		    "No memory for bzip2 decompression");
2294
		    "No memory for bzip2 decompression");
Lines 2331-2337 zip_read_data_zipx_bzip2(struct archive_read *a, const void **buff, Link Here
2331
		return (ARCHIVE_FATAL);
2327
		return (ARCHIVE_FATAL);
2332
	}
2328
	}
2333
2329
2334
	in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
2330
	in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
2335
	if(in_bytes < 1) {
2331
	if(in_bytes < 1) {
2336
		/* libbz2 doesn't complain when caller feeds avail_in == 0.
2332
		/* libbz2 doesn't complain when caller feeds avail_in == 0.
2337
		 * It will actually return success in this case, which is
2333
		 * It will actually return success in this case, which is
Lines 2394-2400 zip_read_data_zipx_bzip2(struct archive_read *a, const void **buff, Link Here
2394
	zip->entry_uncompressed_bytes_read += total_out;
2390
	zip->entry_uncompressed_bytes_read += total_out;
2395
2391
2396
	/* Give libarchive its due. */
2392
	/* Give libarchive its due. */
2397
	*size = total_out;
2393
	*size = (size_t)total_out;
2398
	*buff = zip->uncompressed_buffer;
2394
	*buff = zip->uncompressed_buffer;
2399
2395
2400
	return ARCHIVE_OK;
2396
	return ARCHIVE_OK;
Lines 2434-2441 zipx_zstd_init(struct archive_read *a, struct zip *zip) Link Here
2434
	free(zip->uncompressed_buffer);
2430
	free(zip->uncompressed_buffer);
2435
2431
2436
	zip->uncompressed_buffer_size = ZSTD_DStreamOutSize();
2432
	zip->uncompressed_buffer_size = ZSTD_DStreamOutSize();
2437
	zip->uncompressed_buffer =
2433
	zip->uncompressed_buffer = malloc(zip->uncompressed_buffer_size);
2438
	    (uint8_t*) malloc(zip->uncompressed_buffer_size);
2439
	if (zip->uncompressed_buffer == NULL) {
2434
	if (zip->uncompressed_buffer == NULL) {
2440
		archive_set_error(&a->archive, ENOMEM,
2435
		archive_set_error(&a->archive, ENOMEM,
2441
			"No memory for Zstd decompression");
2436
			"No memory for Zstd decompression");
Lines 2478-2484 zip_read_data_zipx_zstd(struct archive_read *a, const void **buff, Link Here
2478
		return (ARCHIVE_FATAL);
2473
		return (ARCHIVE_FATAL);
2479
	}
2474
	}
2480
2475
2481
	in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail);
2476
	in_bytes = (ssize_t)zipmin(zip->entry_bytes_remaining, bytes_avail);
2482
	if(in_bytes < 1) {
2477
	if(in_bytes < 1) {
2483
		/* zstd doesn't complain when caller feeds avail_in == 0.
2478
		/* zstd doesn't complain when caller feeds avail_in == 0.
2484
		 * It will actually return success in this case, which is
2479
		 * It will actually return success in this case, which is
Lines 2524-2530 zip_read_data_zipx_zstd(struct archive_read *a, const void **buff, Link Here
2524
	zip->entry_uncompressed_bytes_read += total_out;
2519
	zip->entry_uncompressed_bytes_read += total_out;
2525
2520
2526
	/* Give libarchive its due. */
2521
	/* Give libarchive its due. */
2527
	*size = total_out;
2522
	*size = (size_t)total_out;
2528
	*buff = zip->uncompressed_buffer;
2523
	*buff = zip->uncompressed_buffer;
2529
2524
2530
	return ARCHIVE_OK;
2525
	return ARCHIVE_OK;
Lines 2574-2580 zip_read_data_deflate(struct archive_read *a, const void **buff, Link Here
2574
	if (zip->uncompressed_buffer == NULL) {
2569
	if (zip->uncompressed_buffer == NULL) {
2575
		zip->uncompressed_buffer_size = 256 * 1024;
2570
		zip->uncompressed_buffer_size = 256 * 1024;
2576
		zip->uncompressed_buffer
2571
		zip->uncompressed_buffer
2577
		    = (unsigned char *)malloc(zip->uncompressed_buffer_size);
2572
		    = malloc(zip->uncompressed_buffer_size);
2578
		if (zip->uncompressed_buffer == NULL) {
2573
		if (zip->uncompressed_buffer == NULL) {
2579
			archive_set_error(&a->archive, ENOMEM,
2574
			archive_set_error(&a->archive, ENOMEM,
2580
			    "No memory for ZIP decompression");
2575
			    "No memory for ZIP decompression");
Lines 3600-3606 archive_read_support_format_zip_streamable(struct archive *_a) Link Here
3600
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
3595
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
3601
	    ARCHIVE_STATE_NEW, "archive_read_support_format_zip");
3596
	    ARCHIVE_STATE_NEW, "archive_read_support_format_zip");
3602
3597
3603
	zip = (struct zip *)calloc(1, sizeof(*zip));
3598
	zip = calloc(1, sizeof(*zip));
3604
	if (zip == NULL) {
3599
	if (zip == NULL) {
3605
		archive_set_error(&a->archive, ENOMEM,
3600
		archive_set_error(&a->archive, ENOMEM,
3606
		    "Can't allocate zip data");
3601
		    "Can't allocate zip data");
Lines 3680-3686 read_eocd(struct zip *zip, const char *p, int64_t current_offset) Link Here
3680
	if (archive_le16dec(p + 10) != archive_le16dec(p + 8))
3675
	if (archive_le16dec(p + 10) != archive_le16dec(p + 8))
3681
		return 0;
3676
		return 0;
3682
	/* Central directory can't extend beyond start of EOCD record. */
3677
	/* Central directory can't extend beyond start of EOCD record. */
3683
	if (cd_offset + cd_size > current_offset)
3678
	if ((int64_t)cd_offset + cd_size > current_offset)
3684
		return 0;
3679
		return 0;
3685
3680
3686
	/* Save the central directory location for later use. */
3681
	/* Save the central directory location for later use. */
Lines 4392-4398 archive_read_support_format_zip_seekable(struct archive *_a) Link Here
4392
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
4387
	archive_check_magic(_a, ARCHIVE_READ_MAGIC,
4393
	    ARCHIVE_STATE_NEW, "archive_read_support_format_zip_seekable");
4388
	    ARCHIVE_STATE_NEW, "archive_read_support_format_zip_seekable");
4394
4389
4395
	zip = (struct zip *)calloc(1, sizeof(*zip));
4390
	zip = calloc(1, sizeof(*zip));
4396
	if (zip == NULL) {
4391
	if (zip == NULL) {
4397
		archive_set_error(&a->archive, ENOMEM,
4392
		archive_set_error(&a->archive, ENOMEM,
4398
		    "Can't allocate zip data");
4393
		    "Can't allocate zip data");
(-)b/contrib/libarchive/libarchive/archive_string.c (-12 / +74 lines)
Lines 313-319 archive_string_ensure(struct archive_string *as, size_t s) Link Here
313
	if (new_length < s)
313
	if (new_length < s)
314
		new_length = s;
314
		new_length = s;
315
	/* Now we can reallocate the buffer. */
315
	/* Now we can reallocate the buffer. */
316
	p = (char *)realloc(as->s, new_length);
316
	p = realloc(as->s, new_length);
317
	if (p == NULL) {
317
	if (p == NULL) {
318
		/* On failure, wipe the string and return NULL. */
318
		/* On failure, wipe the string and return NULL. */
319
		archive_string_free(as);
319
		archive_string_free(as);
Lines 3874-3879 archive_mstring_get_utf8(struct archive *a, struct archive_mstring *aes, Link Here
3874
	}
3874
	}
3875
3875
3876
	*p = NULL;
3876
	*p = NULL;
3877
#if defined(_WIN32) && !defined(__CYGWIN__)
3878
	/*
3879
	 * On Windows, first try converting from WCS because (1) there's no
3880
	 * guarantee that the conversion to MBS will succeed, e.g. when using
3881
	 * CP_ACP, and (2) that's more efficient than converting to MBS, just to
3882
	 * convert back to WCS again before finally converting to UTF-8
3883
	 */
3884
	if ((aes->aes_set & AES_SET_WCS) != 0) {
3885
		sc = archive_string_conversion_to_charset(a, "UTF-8", 1);
3886
		if (sc == NULL)
3887
			return (-1);/* Couldn't allocate memory for sc. */
3888
		archive_string_empty(&(aes->aes_utf8));
3889
		r = archive_string_append_from_wcs_in_codepage(&(aes->aes_utf8),
3890
			aes->aes_wcs.s, aes->aes_wcs.length, sc);
3891
		if (a == NULL)
3892
			free_sconv_object(sc);
3893
		if (r == 0) {
3894
			aes->aes_set |= AES_SET_UTF8;
3895
			*p = aes->aes_utf8.s;
3896
			return (0);/* success. */
3897
		} else
3898
			return (-1);/* failure. */
3899
	}
3900
#endif
3877
	/* Try converting WCS to MBS first if MBS does not exist yet. */
3901
	/* Try converting WCS to MBS first if MBS does not exist yet. */
3878
	if ((aes->aes_set & AES_SET_MBS) == 0) {
3902
	if ((aes->aes_set & AES_SET_MBS) == 0) {
3879
		const char *pm; /* unused */
3903
		const char *pm; /* unused */
Lines 3958-3963 archive_mstring_get_wcs(struct archive *a, struct archive_mstring *aes, Link Here
3958
	}
3982
	}
3959
3983
3960
	*wp = NULL;
3984
	*wp = NULL;
3985
#if defined(_WIN32) && !defined(__CYGWIN__)
3986
	/*
3987
	 * On Windows, prefer converting from UTF-8 directly to WCS because:
3988
	 * (1) there's no guarantee that the string can be represented in MBS (e.g.
3989
	 * with CP_ACP), and (2) in order to convert from UTF-8 to MBS, we're going
3990
	 * to need to convert from UTF-8 to WCS anyway and its wasteful to throw
3991
	 * away that intermediate result
3992
	 */
3993
	if (aes->aes_set & AES_SET_UTF8) {
3994
		struct archive_string_conv *sc;
3995
3996
		sc = archive_string_conversion_from_charset(a, "UTF-8", 1);
3997
		if (sc != NULL) {
3998
			archive_wstring_empty((&aes->aes_wcs));
3999
			r = archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),
4000
			    aes->aes_utf8.s, aes->aes_utf8.length, sc);
4001
			if (a == NULL)
4002
				free_sconv_object(sc);
4003
			if (r == 0) {
4004
				aes->aes_set |= AES_SET_WCS;
4005
				*wp = aes->aes_wcs.s;
4006
				return (0);
4007
			}
4008
		}
4009
	}
4010
#endif
3961
	/* Try converting UTF8 to MBS first if MBS does not exist yet. */
4011
	/* Try converting UTF8 to MBS first if MBS does not exist yet. */
3962
	if ((aes->aes_set & AES_SET_MBS) == 0) {
4012
	if ((aes->aes_set & AES_SET_MBS) == 0) {
3963
		const char *p; /* unused */
4013
		const char *p; /* unused */
Lines 4211-4231 archive_mstring_update_utf8(struct archive *a, struct archive_mstring *aes, Link Here
4211
4261
4212
	aes->aes_set = AES_SET_UTF8;	/* Only UTF8 is set now. */
4262
	aes->aes_set = AES_SET_UTF8;	/* Only UTF8 is set now. */
4213
4263
4214
	/* Try converting UTF-8 to MBS, return false on failure. */
4215
	sc = archive_string_conversion_from_charset(a, "UTF-8", 1);
4264
	sc = archive_string_conversion_from_charset(a, "UTF-8", 1);
4216
	if (sc == NULL)
4265
	if (sc == NULL)
4217
		return (-1);/* Couldn't allocate memory for sc. */
4266
		return (-1);/* Couldn't allocate memory for sc. */
4218
	r = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);
4219
4267
4220
#if defined(_WIN32) && !defined(__CYGWIN__)
4268
#if defined(_WIN32) && !defined(__CYGWIN__)
4221
	/* On failure, make an effort to convert UTF8 to WCS as the active code page
4269
	/* On Windows, there's no good way to convert from UTF8 -> MBS directly, so
4222
	 * may not be able to represent all characters in the string */
4270
	 * prefer to first convert to WCS as (1) it's wasteful to throw away the
4223
	if (r != 0) {
4271
	 * intermediate result, and (2) WCS will still be set even if we fail to
4224
		if (archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),
4272
	 * convert to MBS (e.g. with ACP that can't represent the characters) */
4225
			aes->aes_utf8.s, aes->aes_utf8.length, sc) == 0)
4273
	r = archive_wstring_append_from_mbs_in_codepage(&(aes->aes_wcs),
4226
			aes->aes_set = AES_SET_UTF8 | AES_SET_WCS;
4274
		aes->aes_utf8.s, aes->aes_utf8.length, sc);
4227
	}
4275
4228
#endif
4276
	if (a == NULL)
4277
		free_sconv_object(sc);
4278
	if (r != 0)
4279
		return (-1); /* This will guarantee we can't convert to MBS */
4280
	aes->aes_set = AES_SET_UTF8 | AES_SET_WCS; /* Both UTF8 and WCS set. */
4281
4282
	/* Try converting WCS to MBS, return false on failure. */
4283
	if (archive_string_append_from_wcs(&(aes->aes_mbs), aes->aes_wcs.s,
4284
	    aes->aes_wcs.length))
4285
		return (-1);
4286
#else
4287
	/* Try converting UTF-8 to MBS, return false on failure. */
4288
	r = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);
4229
4289
4230
	if (a == NULL)
4290
	if (a == NULL)
4231
		free_sconv_object(sc);
4291
		free_sconv_object(sc);
Lines 4237-4244 archive_mstring_update_utf8(struct archive *a, struct archive_mstring *aes, Link Here
4237
	if (archive_wstring_append_from_mbs(&(aes->aes_wcs), aes->aes_mbs.s,
4297
	if (archive_wstring_append_from_mbs(&(aes->aes_wcs), aes->aes_mbs.s,
4238
	    aes->aes_mbs.length))
4298
	    aes->aes_mbs.length))
4239
		return (-1);
4299
		return (-1);
4240
	aes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;
4300
#endif
4241
4301
4242
	/* All conversions succeeded. */
4302
	/* All conversions succeeded. */
4303
	aes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;
4304
4243
	return (0);
4305
	return (0);
4244
}
4306
}
(-)b/contrib/libarchive/libarchive/archive_util.c (-8 / +8 lines)
Lines 280-286 __archive_mktempx(const char *tmpdir, wchar_t *template) Link Here
280
			if (archive_wstring_append_from_mbs(&temp_name, tmpdir,
280
			if (archive_wstring_append_from_mbs(&temp_name, tmpdir,
281
			    strlen(tmpdir)) < 0)
281
			    strlen(tmpdir)) < 0)
282
				goto exit_tmpfile;
282
				goto exit_tmpfile;
283
			if (temp_name.s[temp_name.length-1] != L'/')
283
			if (temp_name.length == 0 ||
284
			    temp_name.s[temp_name.length-1] != L'/')
284
				archive_wstrappend_wchar(&temp_name, L'/');
285
				archive_wstrappend_wchar(&temp_name, L'/');
285
		}
286
		}
286
287
Lines 454-460 get_tempdir(struct archive_string *temppath) Link Here
454
                tmp = "/tmp";
455
                tmp = "/tmp";
455
#endif
456
#endif
456
	archive_strcpy(temppath, tmp);
457
	archive_strcpy(temppath, tmp);
457
	if (temppath->s[temppath->length-1] != '/')
458
	if (temppath->length == 0 || temppath->s[temppath->length-1] != '/')
458
		archive_strappend_char(temppath, '/');
459
		archive_strappend_char(temppath, '/');
459
	return (ARCHIVE_OK);
460
	return (ARCHIVE_OK);
460
}
461
}
Lines 477-483 __archive_mktemp(const char *tmpdir) Link Here
477
			goto exit_tmpfile;
478
			goto exit_tmpfile;
478
	} else {
479
	} else {
479
		archive_strcpy(&temp_name, tmpdir);
480
		archive_strcpy(&temp_name, tmpdir);
480
		if (temp_name.s[temp_name.length-1] != '/')
481
		if (temp_name.length == 0 ||
482
		    temp_name.s[temp_name.length-1] != '/')
481
			archive_strappend_char(&temp_name, '/');
483
			archive_strappend_char(&temp_name, '/');
482
	}
484
	}
483
#ifdef O_TMPFILE
485
#ifdef O_TMPFILE
Lines 538-544 __archive_mktempx(const char *tmpdir, char *template) Link Here
538
				goto exit_tmpfile;
540
				goto exit_tmpfile;
539
		} else
541
		} else
540
			archive_strcpy(&temp_name, tmpdir);
542
			archive_strcpy(&temp_name, tmpdir);
541
		if (temp_name.s[temp_name.length-1] == '/') {
543
		if (temp_name.length > 0 && temp_name.s[temp_name.length-1] == '/') {
542
			temp_name.s[temp_name.length-1] = '\0';
544
			temp_name.s[temp_name.length-1] = '\0';
543
			temp_name.length --;
545
			temp_name.length --;
544
		}
546
		}
Lines 649-656 archive_utility_string_sort_helper(char **strings, unsigned int n) Link Here
649
		if (strcmp(strings[i], pivot) < 0)
651
		if (strcmp(strings[i], pivot) < 0)
650
		{
652
		{
651
			lesser_count++;
653
			lesser_count++;
652
			tmp = (char **)realloc(lesser,
654
			tmp = realloc(lesser, lesser_count * sizeof(*tmp));
653
				lesser_count * sizeof(char *));
654
			if (!tmp) {
655
			if (!tmp) {
655
				free(greater);
656
				free(greater);
656
				free(lesser);
657
				free(lesser);
Lines 662-669 archive_utility_string_sort_helper(char **strings, unsigned int n) Link Here
662
		else
663
		else
663
		{
664
		{
664
			greater_count++;
665
			greater_count++;
665
			tmp = (char **)realloc(greater,
666
			tmp = realloc(greater, greater_count * sizeof(*tmp));
666
				greater_count * sizeof(char *));
667
			if (!tmp) {
667
			if (!tmp) {
668
				free(greater);
668
				free(greater);
669
				free(lesser);
669
				free(lesser);
(-)b/contrib/libarchive/libarchive/archive_write.c (-5 / +14 lines)
Lines 98-104 archive_write_new(void) Link Here
98
	struct archive_write *a;
98
	struct archive_write *a;
99
	unsigned char *nulls;
99
	unsigned char *nulls;
100
100
101
	a = (struct archive_write *)calloc(1, sizeof(*a));
101
	a = calloc(1, sizeof(*a));
102
	if (a == NULL)
102
	if (a == NULL)
103
		return (NULL);
103
		return (NULL);
104
	a->archive.magic = ARCHIVE_WRITE_MAGIC;
104
	a->archive.magic = ARCHIVE_WRITE_MAGIC;
Lines 114-120 archive_write_new(void) Link Here
114
114
115
	/* Initialize a block of nulls for padding purposes. */
115
	/* Initialize a block of nulls for padding purposes. */
116
	a->null_length = 1024;
116
	a->null_length = 1024;
117
	nulls = (unsigned char *)calloc(a->null_length, sizeof(unsigned char));
117
	nulls = calloc(a->null_length, sizeof(unsigned char));
118
	if (nulls == NULL) {
118
	if (nulls == NULL) {
119
		free(a);
119
		free(a);
120
		return (NULL);
120
		return (NULL);
Lines 132-143 archive_write_set_bytes_per_block(struct archive *_a, int bytes_per_block) Link Here
132
	struct archive_write *a = (struct archive_write *)_a;
132
	struct archive_write *a = (struct archive_write *)_a;
133
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
133
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
134
	    ARCHIVE_STATE_NEW, "archive_write_set_bytes_per_block");
134
	    ARCHIVE_STATE_NEW, "archive_write_set_bytes_per_block");
135
136
	if (bytes_per_block < 0) {
137
		// Do nothing if the bytes_per_block is negative
138
		return 0;
139
	}
135
	a->bytes_per_block = bytes_per_block;
140
	a->bytes_per_block = bytes_per_block;
136
	return (ARCHIVE_OK);
141
	return (ARCHIVE_OK);
137
}
142
}
138
143
139
/*
144
/*
140
 * Get the current block size.  -1 if it has never been set.
145
 * Get the current block size.
141
 */
146
 */
142
int
147
int
143
archive_write_get_bytes_per_block(struct archive *_a)
148
archive_write_get_bytes_per_block(struct archive *_a)
Lines 145-150 archive_write_get_bytes_per_block(struct archive *_a) Link Here
145
	struct archive_write *a = (struct archive_write *)_a;
150
	struct archive_write *a = (struct archive_write *)_a;
146
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
151
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
147
	    ARCHIVE_STATE_ANY, "archive_write_get_bytes_per_block");
152
	    ARCHIVE_STATE_ANY, "archive_write_get_bytes_per_block");
153
	if (a->bytes_per_block < 0) {
154
		// Don't return a negative value
155
		return 1;
156
	}
148
	return (a->bytes_per_block);
157
	return (a->bytes_per_block);
149
}
158
}
150
159
Lines 358-365 archive_write_client_open(struct archive_write_filter *f) Link Here
358
	    archive_write_get_bytes_in_last_block(f->archive);
367
	    archive_write_get_bytes_in_last_block(f->archive);
359
	buffer_size = f->bytes_per_block;
368
	buffer_size = f->bytes_per_block;
360
369
361
	state = (struct archive_none *)calloc(1, sizeof(*state));
370
	state = calloc(1, sizeof(*state));
362
	buffer = (char *)malloc(buffer_size);
371
	buffer = malloc(buffer_size);
363
	if (state == NULL || buffer == NULL) {
372
	if (state == NULL || buffer == NULL) {
364
		free(state);
373
		free(state);
365
		free(buffer);
374
		free(buffer);
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_b64encode.c (-3 / +3 lines)
Lines 83-91 archive_write_add_filter_b64encode(struct archive *_a) Link Here
83
	struct private_b64encode *state;
83
	struct private_b64encode *state;
84
84
85
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
85
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
86
	    ARCHIVE_STATE_NEW, "archive_write_add_filter_uu");
86
	    ARCHIVE_STATE_NEW, "archive_write_add_filter_b64encode");
87
87
88
	state = (struct private_b64encode *)calloc(1, sizeof(*state));
88
	state = calloc(1, sizeof(*state));
89
	if (state == NULL) {
89
	if (state == NULL) {
90
		archive_set_error(f->archive, ENOMEM,
90
		archive_set_error(f->archive, ENOMEM,
91
		    "Can't allocate data for b64encode filter");
91
		    "Can't allocate data for b64encode filter");
Lines 149-155 archive_filter_b64encode_open(struct archive_write_filter *f) Link Here
149
	size_t bs = 65536, bpb;
149
	size_t bs = 65536, bpb;
150
150
151
	if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
151
	if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
152
		/* Buffer size should be a multiple number of the of bytes
152
		/* Buffer size should be a multiple number of the bytes
153
		 * per block for performance. */
153
		 * per block for performance. */
154
		bpb = archive_write_get_bytes_per_block(f->archive);
154
		bpb = archive_write_get_bytes_per_block(f->archive);
155
		if (bpb > bs)
155
		if (bpb > bs)
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_bzip2.c (-3 / +2 lines)
Lines 168-174 archive_compressor_bzip2_open(struct archive_write_filter *f) Link Here
168
	if (data->compressed == NULL) {
168
	if (data->compressed == NULL) {
169
		size_t bs = 65536, bpb;
169
		size_t bs = 65536, bpb;
170
		if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
170
		if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
171
			/* Buffer size should be a multiple number of the of bytes
171
			/* Buffer size should be a multiple number of the bytes
172
			 * per block for performance. */
172
			 * per block for performance. */
173
			bpb = archive_write_get_bytes_per_block(f->archive);
173
			bpb = archive_write_get_bytes_per_block(f->archive);
174
			if (bpb > bs)
174
			if (bpb > bs)
Lines 177-184 archive_compressor_bzip2_open(struct archive_write_filter *f) Link Here
177
				bs -= bs % bpb;
177
				bs -= bs % bpb;
178
		}
178
		}
179
		data->compressed_buffer_size = bs;
179
		data->compressed_buffer_size = bs;
180
		data->compressed
180
		data->compressed = malloc(data->compressed_buffer_size);
181
		    = (char *)malloc(data->compressed_buffer_size);
182
		if (data->compressed == NULL) {
181
		if (data->compressed == NULL) {
183
			archive_set_error(f->archive, ENOMEM,
182
			archive_set_error(f->archive, ENOMEM,
184
			    "Can't allocate data for compression buffer");
183
			    "Can't allocate data for compression buffer");
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_compress.c (-2 / +2 lines)
Lines 150-156 archive_compressor_compress_open(struct archive_write_filter *f) Link Here
150
	f->code = ARCHIVE_FILTER_COMPRESS;
150
	f->code = ARCHIVE_FILTER_COMPRESS;
151
	f->name = "compress";
151
	f->name = "compress";
152
152
153
	state = (struct private_data *)calloc(1, sizeof(*state));
153
	state = calloc(1, sizeof(*state));
154
	if (state == NULL) {
154
	if (state == NULL) {
155
		archive_set_error(f->archive, ENOMEM,
155
		archive_set_error(f->archive, ENOMEM,
156
		    "Can't allocate data for compression");
156
		    "Can't allocate data for compression");
Lines 158-164 archive_compressor_compress_open(struct archive_write_filter *f) Link Here
158
	}
158
	}
159
159
160
	if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
160
	if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
161
		/* Buffer size should be a multiple number of the of bytes
161
		/* Buffer size should be a multiple number of the bytes
162
		 * per block for performance. */
162
		 * per block for performance. */
163
		bpb = archive_write_get_bytes_per_block(f->archive);
163
		bpb = archive_write_get_bytes_per_block(f->archive);
164
		if (bpb > bs)
164
		if (bpb > bs)
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_gzip.c (-2 / +1 lines)
Lines 194-201 archive_compressor_gzip_open(struct archive_write_filter *f) Link Here
194
				bs -= bs % bpb;
194
				bs -= bs % bpb;
195
		}
195
		}
196
		data->compressed_buffer_size = bs;
196
		data->compressed_buffer_size = bs;
197
		data->compressed
197
		data->compressed = malloc(data->compressed_buffer_size);
198
		    = (unsigned char *)malloc(data->compressed_buffer_size);
199
		if (data->compressed == NULL) {
198
		if (data->compressed == NULL) {
200
			archive_set_error(f->archive, ENOMEM,
199
			archive_set_error(f->archive, ENOMEM,
201
			    "Can't allocate data for compression buffer");
200
			    "Can't allocate data for compression buffer");
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_uuencode.c (-1 / +1 lines)
Lines 74-80 archive_write_add_filter_uuencode(struct archive *_a) Link Here
74
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
74
	archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
75
	    ARCHIVE_STATE_NEW, "archive_write_add_filter_uu");
75
	    ARCHIVE_STATE_NEW, "archive_write_add_filter_uu");
76
76
77
	state = (struct private_uuencode *)calloc(1, sizeof(*state));
77
	state = calloc(1, sizeof(*state));
78
	if (state == NULL) {
78
	if (state == NULL) {
79
		archive_set_error(f->archive, ENOMEM,
79
		archive_set_error(f->archive, ENOMEM,
80
		    "Can't allocate data for uuencode filter");
80
		    "Can't allocate data for uuencode filter");
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_xz.c (-3 / +2 lines)
Lines 310-316 archive_compressor_xz_open(struct archive_write_filter *f) Link Here
310
	if (data->compressed == NULL) {
310
	if (data->compressed == NULL) {
311
		size_t bs = 65536, bpb;
311
		size_t bs = 65536, bpb;
312
		if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
312
		if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
313
			/* Buffer size should be a multiple number of the of bytes
313
			/* Buffer size should be a multiple number of the bytes
314
			 * per block for performance. */
314
			 * per block for performance. */
315
			bpb = archive_write_get_bytes_per_block(f->archive);
315
			bpb = archive_write_get_bytes_per_block(f->archive);
316
			if (bpb > bs)
316
			if (bpb > bs)
Lines 319-326 archive_compressor_xz_open(struct archive_write_filter *f) Link Here
319
				bs -= bs % bpb;
319
				bs -= bs % bpb;
320
		}
320
		}
321
		data->compressed_buffer_size = bs;
321
		data->compressed_buffer_size = bs;
322
		data->compressed
322
		data->compressed = malloc(data->compressed_buffer_size);
323
		    = (unsigned char *)malloc(data->compressed_buffer_size);
324
		if (data->compressed == NULL) {
323
		if (data->compressed == NULL) {
325
			archive_set_error(f->archive, ENOMEM,
324
			archive_set_error(f->archive, ENOMEM,
326
			    "Can't allocate data for compression buffer");
325
			    "Can't allocate data for compression buffer");
(-)b/contrib/libarchive/libarchive/archive_write_add_filter_zstd.c (-2 / +1 lines)
Lines 372-379 archive_compressor_zstd_open(struct archive_write_filter *f) Link Here
372
		}
372
		}
373
		data->out.size = bs;
373
		data->out.size = bs;
374
		data->out.pos = 0;
374
		data->out.pos = 0;
375
		data->out.dst
375
		data->out.dst = malloc(data->out.size);
376
		    = (unsigned char *)malloc(data->out.size);
377
		if (data->out.dst == NULL) {
376
		if (data->out.dst == NULL) {
378
			archive_set_error(f->archive, ENOMEM,
377
			archive_set_error(f->archive, ENOMEM,
379
			    "Can't allocate data for compression buffer");
378
			    "Can't allocate data for compression buffer");
(-)b/contrib/libarchive/libarchive/archive_write_disk_posix.c (-9 / +7 lines)
Lines 1991-1997 archive_write_disk_new(void) Link Here
1991
{
1991
{
1992
	struct archive_write_disk *a;
1992
	struct archive_write_disk *a;
1993
1993
1994
	a = (struct archive_write_disk *)calloc(1, sizeof(*a));
1994
	a = calloc(1, sizeof(*a));
1995
	if (a == NULL)
1995
	if (a == NULL)
1996
		return (NULL);
1996
		return (NULL);
1997
	a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC;
1997
	a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC;
Lines 2758-2764 new_fixup(struct archive_write_disk *a, const char *pathname) Link Here
2758
{
2758
{
2759
	struct fixup_entry *fe;
2759
	struct fixup_entry *fe;
2760
2760
2761
	fe = (struct fixup_entry *)calloc(1, sizeof(struct fixup_entry));
2761
	fe = calloc(1, sizeof(struct fixup_entry));
2762
	if (fe == NULL) {
2762
	if (fe == NULL) {
2763
		archive_set_error(&a->archive, ENOMEM,
2763
		archive_set_error(&a->archive, ENOMEM,
2764
		    "Can't allocate memory for a fixup");
2764
		    "Can't allocate memory for a fixup");
Lines 4196-4202 copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd) Link Here
4196
	}
4196
	}
4197
	for (xattr_i = 0; xattr_i < xattr_size;
4197
	for (xattr_i = 0; xattr_i < xattr_size;
4198
	    xattr_i += strlen(xattr_names + xattr_i) + 1) {
4198
	    xattr_i += strlen(xattr_names + xattr_i) + 1) {
4199
		char *xattr_val_saved;
4199
		char *p;
4200
		ssize_t s;
4200
		ssize_t s;
4201
		int f;
4201
		int f;
4202
4202
Lines 4207-4221 copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd) Link Here
4207
			ret = ARCHIVE_WARN;
4207
			ret = ARCHIVE_WARN;
4208
			goto exit_xattr;
4208
			goto exit_xattr;
4209
		}
4209
		}
4210
		xattr_val_saved = xattr_val;
4210
		p = realloc(xattr_val, s);
4211
		xattr_val = realloc(xattr_val, s);
4211
		if (p == NULL) {
4212
		if (xattr_val == NULL) {
4213
			archive_set_error(&a->archive, ENOMEM,
4212
			archive_set_error(&a->archive, ENOMEM,
4214
			    "Failed to get metadata(xattr)");
4213
			    "Failed to get metadata(xattr)");
4215
			ret = ARCHIVE_WARN;
4214
			ret = ARCHIVE_WARN;
4216
			free(xattr_val_saved);
4217
			goto exit_xattr;
4215
			goto exit_xattr;
4218
		}
4216
		}
4217
		xattr_val = p;
4219
		s = fgetxattr(tmpfd, xattr_names + xattr_i, xattr_val, s, 0, 0);
4218
		s = fgetxattr(tmpfd, xattr_names + xattr_i, xattr_val, s, 0, 0);
4220
		if (s == -1) {
4219
		if (s == -1) {
4221
			archive_set_error(&a->archive, errno,
4220
			archive_set_error(&a->archive, errno,
Lines 4361-4368 set_mac_metadata(struct archive_write_disk *a, const char *pathname, Link Here
4361
	 * silly dance of writing the data to disk just so that
4360
	 * silly dance of writing the data to disk just so that
4362
	 * copyfile() can read it back in again. */
4361
	 * copyfile() can read it back in again. */
4363
	archive_string_init(&tmp);
4362
	archive_string_init(&tmp);
4364
	archive_strcpy(&tmp, pathname);
4363
	archive_strcpy(&tmp, "tar.mmd.XXXXXX");
4365
	archive_strcat(&tmp, ".XXXXXX");
4366
	fd = mkstemp(tmp.s);
4364
	fd = mkstemp(tmp.s);
4367
4365
4368
	if (fd < 0) {
4366
	if (fd < 0) {
(-)b/contrib/libarchive/libarchive/archive_write_open_fd.c (-1 / +1 lines)
Lines 62-68 archive_write_open_fd(struct archive *a, int fd) Link Here
62
{
62
{
63
	struct write_fd_data *mine;
63
	struct write_fd_data *mine;
64
64
65
	mine = (struct write_fd_data *)malloc(sizeof(*mine));
65
	mine = malloc(sizeof(*mine));
66
	if (mine == NULL) {
66
	if (mine == NULL) {
67
		archive_set_error(a, ENOMEM, "No memory");
67
		archive_set_error(a, ENOMEM, "No memory");
68
		return (ARCHIVE_FATAL);
68
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_write_open_file.c (-1 / +1 lines)
Lines 59-65 archive_write_open_FILE(struct archive *a, FILE *f) Link Here
59
{
59
{
60
	struct write_FILE_data *mine;
60
	struct write_FILE_data *mine;
61
61
62
	mine = (struct write_FILE_data *)malloc(sizeof(*mine));
62
	mine = malloc(sizeof(*mine));
63
	if (mine == NULL) {
63
	if (mine == NULL) {
64
		archive_set_error(a, ENOMEM, "No memory");
64
		archive_set_error(a, ENOMEM, "No memory");
65
		return (ARCHIVE_FATAL);
65
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_write_open_filename.c (-1 / +1 lines)
Lines 98-104 open_filename(struct archive *a, int mbs_fn, const void *filename) Link Here
98
	struct write_file_data *mine;
98
	struct write_file_data *mine;
99
	int r;
99
	int r;
100
100
101
	mine = (struct write_file_data *)calloc(1, sizeof(*mine));
101
	mine = calloc(1, sizeof(*mine));
102
	if (mine == NULL) {
102
	if (mine == NULL) {
103
		archive_set_error(a, ENOMEM, "No memory");
103
		archive_set_error(a, ENOMEM, "No memory");
104
		return (ARCHIVE_FATAL);
104
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_write_open_memory.c (-1 / +1 lines)
Lines 52-58 archive_write_open_memory(struct archive *a, void *buff, size_t buffSize, size_t Link Here
52
{
52
{
53
	struct write_memory_data *mine;
53
	struct write_memory_data *mine;
54
54
55
	mine = (struct write_memory_data *)calloc(1, sizeof(*mine));
55
	mine = calloc(1, sizeof(*mine));
56
	if (mine == NULL) {
56
	if (mine == NULL) {
57
		archive_set_error(a, ENOMEM, "No memory");
57
		archive_set_error(a, ENOMEM, "No memory");
58
		return (ARCHIVE_FATAL);
58
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_write_set_format_7zip.c (-3 / +13 lines)
Lines 521-527 _7z_write_header(struct archive_write *a, struct archive_entry *entry) Link Here
521
	 */
521
	 */
522
	if (archive_entry_filetype(entry) == AE_IFLNK) {
522
	if (archive_entry_filetype(entry) == AE_IFLNK) {
523
		ssize_t bytes;
523
		ssize_t bytes;
524
		const void *p = (const void *)archive_entry_symlink(entry);
524
		const void *p = (const void *)archive_entry_symlink_utf8(entry);
525
		bytes = compress_out(a, p, (size_t)file->size, ARCHIVE_Z_RUN);
525
		bytes = compress_out(a, p, (size_t)file->size, ARCHIVE_Z_RUN);
526
		if (bytes < 0)
526
		if (bytes < 0)
527
			return ((int)bytes);
527
			return ((int)bytes);
Lines 1563-1570 file_new(struct archive_write *a, struct archive_entry *entry, Link Here
1563
		archive_entry_set_size(entry, 0);
1563
		archive_entry_set_size(entry, 0);
1564
	if (archive_entry_filetype(entry) == AE_IFDIR)
1564
	if (archive_entry_filetype(entry) == AE_IFDIR)
1565
		file->dir = 1;
1565
		file->dir = 1;
1566
	else if (archive_entry_filetype(entry) == AE_IFLNK)
1566
	else if (archive_entry_filetype(entry) == AE_IFLNK) {
1567
		file->size = strlen(archive_entry_symlink(entry));
1567
		const char* linkpath;
1568
		linkpath = archive_entry_symlink_utf8(entry);
1569
		if (linkpath == NULL) {
1570
			free(file);
1571
			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
1572
			    "symlink path could not be converted to UTF-8");
1573
			return (ARCHIVE_FAILED);
1574
		}
1575
		else
1576
			file->size = strlen(linkpath);
1577
	}
1568
	if (archive_entry_mtime_is_set(entry)) {
1578
	if (archive_entry_mtime_is_set(entry)) {
1569
		file->flg |= MTIME_IS_SET;
1579
		file->flg |= MTIME_IS_SET;
1570
		file->times[MTIME].time = archive_entry_mtime(entry);
1580
		file->times[MTIME].time = archive_entry_mtime(entry);
(-)b/contrib/libarchive/libarchive/archive_write_set_format_ar.c (-3 / +3 lines)
Lines 126-132 archive_write_set_format_ar(struct archive_write *a) Link Here
126
	if (a->format_free != NULL)
126
	if (a->format_free != NULL)
127
		(a->format_free)(a);
127
		(a->format_free)(a);
128
128
129
	ar = (struct ar_w *)calloc(1, sizeof(*ar));
129
	ar = calloc(1, sizeof(*ar));
130
	if (ar == NULL) {
130
	if (ar == NULL) {
131
		archive_set_error(&a->archive, ENOMEM, "Can't allocate ar data");
131
		archive_set_error(&a->archive, ENOMEM, "Can't allocate ar data");
132
		return (ARCHIVE_FATAL);
132
		return (ARCHIVE_FATAL);
Lines 246-252 archive_write_ar_header(struct archive_write *a, struct archive_entry *entry) Link Here
246
				return (ARCHIVE_WARN);
246
				return (ARCHIVE_WARN);
247
			}
247
			}
248
248
249
			se = (char *)malloc(strlen(filename) + 3);
249
			se = malloc(strlen(filename) + 3);
250
			if (se == NULL) {
250
			if (se == NULL) {
251
				archive_set_error(&a->archive, ENOMEM,
251
				archive_set_error(&a->archive, ENOMEM,
252
				    "Can't allocate filename buffer");
252
				    "Can't allocate filename buffer");
Lines 379-385 archive_write_ar_data(struct archive_write *a, const void *buff, size_t s) Link Here
379
			return (ARCHIVE_WARN);
379
			return (ARCHIVE_WARN);
380
		}
380
		}
381
381
382
		ar->strtab = (char *)malloc(s + 1);
382
		ar->strtab = malloc(s + 1);
383
		if (ar->strtab == NULL) {
383
		if (ar->strtab == NULL) {
384
			archive_set_error(&a->archive, ENOMEM,
384
			archive_set_error(&a->archive, ENOMEM,
385
			    "Can't allocate strtab buffer");
385
			    "Can't allocate strtab buffer");
(-)b/contrib/libarchive/libarchive/archive_write_set_format_cpio_binary.c (-1 / +4 lines)
Lines 185-191 archive_write_set_format_cpio_binary(struct archive *_a, int format) Link Here
185
	if (a->format_free != NULL)
185
	if (a->format_free != NULL)
186
		(a->format_free)(a);
186
		(a->format_free)(a);
187
187
188
	cpio = (struct cpio *)calloc(1, sizeof(*cpio));
188
	cpio = calloc(1, sizeof(*cpio));
189
	if (cpio == NULL) {
189
	if (cpio == NULL) {
190
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
190
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
191
		return (ARCHIVE_FATAL);
191
		return (ARCHIVE_FATAL);
Lines 577-582 archive_write_binary_close(struct archive_write *a) Link Here
577
	struct archive_entry *trailer;
577
	struct archive_entry *trailer;
578
578
579
	trailer = archive_entry_new2(NULL);
579
	trailer = archive_entry_new2(NULL);
580
	if (trailer == NULL) {
581
		return ARCHIVE_FATAL;
582
	}
580
	/* nlink = 1 here for GNU cpio compat. */
583
	/* nlink = 1 here for GNU cpio compat. */
581
	archive_entry_set_nlink(trailer, 1);
584
	archive_entry_set_nlink(trailer, 1);
582
	archive_entry_set_size(trailer, 0);
585
	archive_entry_set_size(trailer, 0);
(-)b/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c (-1 / +1 lines)
Lines 116-122 archive_write_set_format_cpio_newc(struct archive *_a) Link Here
116
	if (a->format_free != NULL)
116
	if (a->format_free != NULL)
117
		(a->format_free)(a);
117
		(a->format_free)(a);
118
118
119
	cpio = (struct cpio *)calloc(1, sizeof(*cpio));
119
	cpio = calloc(1, sizeof(*cpio));
120
	if (cpio == NULL) {
120
	if (cpio == NULL) {
121
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
121
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
122
		return (ARCHIVE_FATAL);
122
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_write_set_format_cpio_odc.c (-1 / +4 lines)
Lines 110-116 archive_write_set_format_cpio_odc(struct archive *_a) Link Here
110
	if (a->format_free != NULL)
110
	if (a->format_free != NULL)
111
		(a->format_free)(a);
111
		(a->format_free)(a);
112
112
113
	cpio = (struct cpio *)calloc(1, sizeof(*cpio));
113
	cpio = calloc(1, sizeof(*cpio));
114
	if (cpio == NULL) {
114
	if (cpio == NULL) {
115
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
115
		archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
116
		return (ARCHIVE_FATAL);
116
		return (ARCHIVE_FATAL);
Lines 467-472 archive_write_odc_close(struct archive_write *a) Link Here
467
	struct archive_entry *trailer;
467
	struct archive_entry *trailer;
468
468
469
	trailer = archive_entry_new2(NULL);
469
	trailer = archive_entry_new2(NULL);
470
	if (trailer == NULL) {
471
		return ARCHIVE_FATAL;
472
	}
470
	/* nlink = 1 here for GNU cpio compat. */
473
	/* nlink = 1 here for GNU cpio compat. */
471
	archive_entry_set_nlink(trailer, 1);
474
	archive_entry_set_nlink(trailer, 1);
472
	archive_entry_set_size(trailer, 0);
475
	archive_entry_set_size(trailer, 0);
(-)b/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c (-3 / +3 lines)
Lines 174-180 archive_write_set_format_gnutar(struct archive *_a) Link Here
174
	struct archive_write *a = (struct archive_write *)_a;
174
	struct archive_write *a = (struct archive_write *)_a;
175
	struct gnutar *gnutar;
175
	struct gnutar *gnutar;
176
176
177
	gnutar = (struct gnutar *)calloc(1, sizeof(*gnutar));
177
	gnutar = calloc(1, sizeof(*gnutar));
178
	if (gnutar == NULL) {
178
	if (gnutar == NULL) {
179
		archive_set_error(&a->archive, ENOMEM,
179
		archive_set_error(&a->archive, ENOMEM,
180
		    "Can't allocate gnutar data");
180
		    "Can't allocate gnutar data");
Lines 296-302 archive_write_gnutar_header(struct archive_write *a, Link Here
296
	/* Only regular files (not hardlinks) have data. */
296
	/* Only regular files (not hardlinks) have data. */
297
	if (archive_entry_hardlink(entry) != NULL ||
297
	if (archive_entry_hardlink(entry) != NULL ||
298
	    archive_entry_symlink(entry) != NULL ||
298
	    archive_entry_symlink(entry) != NULL ||
299
	    !(archive_entry_filetype(entry) == AE_IFREG))
299
	    archive_entry_filetype(entry) != AE_IFREG)
300
		archive_entry_set_size(entry, 0);
300
		archive_entry_set_size(entry, 0);
301
301
302
	if (AE_IFDIR == archive_entry_filetype(entry)) {
302
	if (AE_IFDIR == archive_entry_filetype(entry)) {
Lines 523-529 archive_write_gnutar_header(struct archive_write *a, Link Here
523
			goto exit_write_header;
523
			goto exit_write_header;
524
	}
524
	}
525
525
526
	if (archive_entry_hardlink(entry) != NULL) {
526
	if (archive_entry_hardlink_is_set(entry)) {
527
		tartype = '1';
527
		tartype = '1';
528
	} else
528
	} else
529
		switch (archive_entry_filetype(entry)) {
529
		switch (archive_entry_filetype(entry)) {
(-)b/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c (-1 / +1 lines)
Lines 2237-2243 set_str_utf16be(struct archive_write *a, unsigned char *p, const char *s, Link Here
2237
	int onepad;
2237
	int onepad;
2238
2238
2239
	if (s == NULL)
2239
	if (s == NULL)
2240
		s = "";
2240
		s = "\0\0";
2241
	if (l & 0x01) {
2241
	if (l & 0x01) {
2242
		onepad = 1;
2242
		onepad = 1;
2243
		l &= ~1;
2243
		l &= ~1;
(-)b/contrib/libarchive/libarchive/archive_write_set_format_pax.c (-4 / +20 lines)
Lines 138-144 archive_write_set_format_pax(struct archive *_a) Link Here
138
	if (a->format_free != NULL)
138
	if (a->format_free != NULL)
139
		(a->format_free)(a);
139
		(a->format_free)(a);
140
140
141
	pax = (struct pax *)calloc(1, sizeof(*pax));
141
	pax = calloc(1, sizeof(*pax));
142
	if (pax == NULL) {
142
	if (pax == NULL) {
143
		archive_set_error(&a->archive, ENOMEM,
143
		archive_set_error(&a->archive, ENOMEM,
144
		    "Can't allocate pax data");
144
		    "Can't allocate pax data");
Lines 608-614 archive_write_pax_header(struct archive_write *a, Link Here
608
	const time_t ustar_max_mtime = get_ustar_max_mtime();
608
	const time_t ustar_max_mtime = get_ustar_max_mtime();
609
609
610
	/* Sanity check. */
610
	/* Sanity check. */
611
#if defined(_WIN32) && !defined(__CYGWIN__)
612
	/* NOTE: If the caller supplied a pathname that fails WCS conversion (e.g.
613
	 * if it is invalid UTF-8), we are expected to return ARCHIVE_WARN later on
614
	 * in execution, hence the check for both pointers */
615
	if ((archive_entry_pathname_w(entry_original) == NULL) &&
616
	    (archive_entry_pathname(entry_original) == NULL)) {
617
#else
611
	if (archive_entry_pathname(entry_original) == NULL) {
618
	if (archive_entry_pathname(entry_original) == NULL) {
619
#endif
612
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
620
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
613
			  "Can't record entry in tar file without pathname");
621
			  "Can't record entry in tar file without pathname");
614
		return (ARCHIVE_FAILED);
622
		return (ARCHIVE_FAILED);
Lines 1032-1037 archive_write_pax_header(struct archive_write *a, Link Here
1032
					archive_entry_set_symlink(entry_main,
1040
					archive_entry_set_symlink(entry_main,
1033
					    "././@LongSymLink");
1041
					    "././@LongSymLink");
1034
			}
1042
			}
1043
			else {
1044
				/* Otherwise, has non-ASCII characters; update the paths to
1045
				 * however they got decoded above */
1046
				if (hardlink != NULL) 
1047
					archive_entry_set_hardlink(entry_main, linkpath);
1048
				else
1049
					archive_entry_set_symlink(entry_main, linkpath);
1050
			}
1035
			need_extension = 1;
1051
			need_extension = 1;
1036
		}
1052
		}
1037
	}
1053
	}
Lines 1928-1934 url_encode(const char *in) Link Here
1928
		}
1944
		}
1929
	}
1945
	}
1930
1946
1931
	out = (char *)malloc(out_len + 1);
1947
	out = malloc(out_len + 1);
1932
	if (out == NULL)
1948
	if (out == NULL)
1933
		return (NULL);
1949
		return (NULL);
1934
1950
Lines 1966-1972 base64_encode(const char *s, size_t len) Link Here
1966
	char *d, *out;
1982
	char *d, *out;
1967
1983
1968
	/* 3 bytes becomes 4 chars, but round up and allow for trailing NUL */
1984
	/* 3 bytes becomes 4 chars, but round up and allow for trailing NUL */
1969
	out = (char *)malloc((len * 4 + 2) / 3 + 1);
1985
	out = malloc((len * 4 + 2) / 3 + 1);
1970
	if (out == NULL)
1986
	if (out == NULL)
1971
		return (NULL);
1987
		return (NULL);
1972
	d = out;
1988
	d = out;
Lines 2021-2027 _sparse_list_add_block(struct pax *pax, int64_t offset, int64_t length, Link Here
2021
{
2037
{
2022
	struct sparse_block *sb;
2038
	struct sparse_block *sb;
2023
2039
2024
	sb = (struct sparse_block *)malloc(sizeof(*sb));
2040
	sb = malloc(sizeof(*sb));
2025
	if (sb == NULL)
2041
	if (sb == NULL)
2026
		return (ARCHIVE_FATAL);
2042
		return (ARCHIVE_FATAL);
2027
	sb->next = NULL;
2043
	sb->next = NULL;
(-)b/contrib/libarchive/libarchive/archive_write_set_format_raw.c (-1 / +1 lines)
Lines 58-64 archive_write_set_format_raw(struct archive *_a) Link Here
58
	if (a->format_free != NULL)
58
	if (a->format_free != NULL)
59
		(a->format_free)(a);
59
		(a->format_free)(a);
60
60
61
	raw = (struct raw *)calloc(1, sizeof(*raw));
61
	raw = calloc(1, sizeof(*raw));
62
	if (raw == NULL) {
62
	if (raw == NULL) {
63
		archive_set_error(&a->archive, ENOMEM, "Can't allocate raw data");
63
		archive_set_error(&a->archive, ENOMEM, "Can't allocate raw data");
64
		return (ARCHIVE_FATAL);
64
		return (ARCHIVE_FATAL);
(-)b/contrib/libarchive/libarchive/archive_write_set_format_shar.c (-1 / +9 lines)
Lines 113-119 archive_write_set_format_shar(struct archive *_a) Link Here
113
	if (a->format_free != NULL)
113
	if (a->format_free != NULL)
114
		(a->format_free)(a);
114
		(a->format_free)(a);
115
115
116
	shar = (struct shar *)calloc(1, sizeof(*shar));
116
	shar = calloc(1, sizeof(*shar));
117
	if (shar == NULL) {
117
	if (shar == NULL) {
118
		archive_set_error(&a->archive, ENOMEM, "Can't allocate shar data");
118
		archive_set_error(&a->archive, ENOMEM, "Can't allocate shar data");
119
		return (ARCHIVE_FATAL);
119
		return (ARCHIVE_FATAL);
Lines 209-214 archive_write_shar_header(struct archive_write *a, struct archive_entry *entry) Link Here
209
	if (archive_entry_filetype(entry) != AE_IFDIR) {
209
	if (archive_entry_filetype(entry) != AE_IFDIR) {
210
		/* Try to create the dir. */
210
		/* Try to create the dir. */
211
		p = strdup(name);
211
		p = strdup(name);
212
		if (p == NULL) {
213
			archive_set_error(&a->archive, ENOMEM, "Out of memory");
214
			return (ARCHIVE_FATAL);
215
		}
212
		pp = strrchr(p, '/');
216
		pp = strrchr(p, '/');
213
		/* If there is a / character, try to create the dir. */
217
		/* If there is a / character, try to create the dir. */
214
		if (pp != NULL) {
218
		if (pp != NULL) {
Lines 291-296 archive_write_shar_header(struct archive_write *a, struct archive_entry *entry) Link Here
291
			free(shar->last_dir);
295
			free(shar->last_dir);
292
296
293
			shar->last_dir = strdup(name);
297
			shar->last_dir = strdup(name);
298
			if (shar->last_dir == NULL) {
299
				archive_set_error(&a->archive, ENOMEM, "Out of memory");
300
				return (ARCHIVE_FATAL);
301
			}
294
			/* Trim a trailing '/'. */
302
			/* Trim a trailing '/'. */
295
			pp = strrchr(shar->last_dir, '/');
303
			pp = strrchr(shar->last_dir, '/');
296
			if (pp != NULL && pp[1] == '\0')
304
			if (pp != NULL && pp[1] == '\0')
(-)b/contrib/libarchive/libarchive/archive_write_set_format_ustar.c (-2 / +6 lines)
Lines 183-189 archive_write_set_format_ustar(struct archive *_a) Link Here
183
		return (ARCHIVE_FATAL);
183
		return (ARCHIVE_FATAL);
184
	}
184
	}
185
185
186
	ustar = (struct ustar *)calloc(1, sizeof(*ustar));
186
	ustar = calloc(1, sizeof(*ustar));
187
	if (ustar == NULL) {
187
	if (ustar == NULL) {
188
		archive_set_error(&a->archive, ENOMEM,
188
		archive_set_error(&a->archive, ENOMEM,
189
		    "Can't allocate ustar data");
189
		    "Can't allocate ustar data");
Lines 254-260 archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry) Link Here
254
		sconv = ustar->opt_sconv;
254
		sconv = ustar->opt_sconv;
255
255
256
	/* Sanity check. */
256
	/* Sanity check. */
257
#if defined(_WIN32) && !defined(__CYGWIN__)
258
	if (archive_entry_pathname_w(entry) == NULL) {
259
#else
257
	if (archive_entry_pathname(entry) == NULL) {
260
	if (archive_entry_pathname(entry) == NULL) {
261
#endif
258
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
262
		archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
259
		    "Can't record entry in tar file without pathname");
263
		    "Can't record entry in tar file without pathname");
260
		return (ARCHIVE_FAILED);
264
		return (ARCHIVE_FAILED);
Lines 263-269 archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry) Link Here
263
	/* Only regular files (not hardlinks) have data. */
267
	/* Only regular files (not hardlinks) have data. */
264
	if (archive_entry_hardlink(entry) != NULL ||
268
	if (archive_entry_hardlink(entry) != NULL ||
265
	    archive_entry_symlink(entry) != NULL ||
269
	    archive_entry_symlink(entry) != NULL ||
266
	    !(archive_entry_filetype(entry) == AE_IFREG))
270
	    archive_entry_filetype(entry) != AE_IFREG)
267
		archive_entry_set_size(entry, 0);
271
		archive_entry_set_size(entry, 0);
268
272
269
	if (AE_IFDIR == archive_entry_filetype(entry)) {
273
	if (AE_IFDIR == archive_entry_filetype(entry)) {
(-)b/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c (-2 / +2 lines)
Lines 160-166 archive_write_set_format_v7tar(struct archive *_a) Link Here
160
		return (ARCHIVE_FATAL);
160
		return (ARCHIVE_FATAL);
161
	}
161
	}
162
162
163
	v7tar = (struct v7tar *)calloc(1, sizeof(*v7tar));
163
	v7tar = calloc(1, sizeof(*v7tar));
164
	if (v7tar == NULL) {
164
	if (v7tar == NULL) {
165
		archive_set_error(&a->archive, ENOMEM,
165
		archive_set_error(&a->archive, ENOMEM,
166
		    "Can't allocate v7tar data");
166
		    "Can't allocate v7tar data");
Lines 241-247 archive_write_v7tar_header(struct archive_write *a, struct archive_entry *entry) Link Here
241
	/* Only regular files (not hardlinks) have data. */
241
	/* Only regular files (not hardlinks) have data. */
242
	if (archive_entry_hardlink(entry) != NULL ||
242
	if (archive_entry_hardlink(entry) != NULL ||
243
	    archive_entry_symlink(entry) != NULL ||
243
	    archive_entry_symlink(entry) != NULL ||
244
	    !(archive_entry_filetype(entry) == AE_IFREG))
244
	    archive_entry_filetype(entry) != AE_IFREG)
245
		archive_entry_set_size(entry, 0);
245
		archive_entry_set_size(entry, 0);
246
246
247
	if (AE_IFDIR == archive_entry_filetype(entry)) {
247
	if (AE_IFDIR == archive_entry_filetype(entry)) {
(-)b/contrib/libarchive/libarchive/archive_write_set_format_xar.c (-13 / +13 lines)
Lines 796-802 xar_finish_entry(struct archive_write *a) Link Here
796
		if (w > 0)
796
		if (w > 0)
797
			xar->bytes_remaining -= w;
797
			xar->bytes_remaining -= w;
798
		else
798
		else
799
			return (w);
799
			return ((int)w);
800
	}
800
	}
801
	file = xar->cur_file;
801
	file = xar->cur_file;
802
	checksum_final(&(xar->e_sumwrk), &(file->data.e_sum));
802
	checksum_final(&(xar->e_sumwrk), &(file->data.e_sum));
Lines 1163-1169 make_file_entry(struct archive_write *a, xmlTextWriterPtr writer, Link Here
1163
	/*
1163
	/*
1164
	 * Make a file name entry, "<name>".
1164
	 * Make a file name entry, "<name>".
1165
	 */
1165
	 */
1166
	l = ll = archive_strlen(&(file->basename));
1166
	l = ll = (int)archive_strlen(&(file->basename));
1167
	tmp = malloc(l);
1167
	tmp = malloc(l);
1168
	if (tmp == NULL) {
1168
	if (tmp == NULL) {
1169
		archive_set_error(&a->archive, ENOMEM,
1169
		archive_set_error(&a->archive, ENOMEM,
Lines 1189-1195 make_file_entry(struct archive_write *a, xmlTextWriterPtr writer, Link Here
1189
			return (ARCHIVE_FATAL);
1189
			return (ARCHIVE_FATAL);
1190
		}
1190
		}
1191
		r = xmlTextWriterWriteBase64(writer, file->basename.s,
1191
		r = xmlTextWriterWriteBase64(writer, file->basename.s,
1192
		    0, archive_strlen(&(file->basename)));
1192
		    0, (int)archive_strlen(&(file->basename)));
1193
		if (r < 0) {
1193
		if (r < 0) {
1194
			archive_set_error(&a->archive,
1194
			archive_set_error(&a->archive,
1195
			    ARCHIVE_ERRNO_MISC,
1195
			    ARCHIVE_ERRNO_MISC,
Lines 2231-2240 get_path_component(char *name, int n, const char *fn) Link Here
2231
2231
2232
	p = strchr(fn, '/');
2232
	p = strchr(fn, '/');
2233
	if (p == NULL) {
2233
	if (p == NULL) {
2234
		if ((l = strlen(fn)) == 0)
2234
		if ((l = (int)strlen(fn)) == 0)
2235
			return (0);
2235
			return (0);
2236
	} else
2236
	} else
2237
		l = p - fn;
2237
		l = (int)(p - fn);
2238
	if (l > n -1)
2238
	if (l > n -1)
2239
		return (-1);
2239
		return (-1);
2240
	memcpy(name, fn, l);
2240
	memcpy(name, fn, l);
Lines 2651-2660 compression_init_encoder_gzip(struct archive *a, Link Here
2651
	 * of ugly hackery to convert a const * pointer to
2651
	 * of ugly hackery to convert a const * pointer to
2652
	 * a non-const pointer. */
2652
	 * a non-const pointer. */
2653
	strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
2653
	strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
2654
	strm->avail_in = lastrm->avail_in;
2654
	strm->avail_in = (uInt)lastrm->avail_in;
2655
	strm->total_in = (uLong)lastrm->total_in;
2655
	strm->total_in = (uLong)lastrm->total_in;
2656
	strm->next_out = lastrm->next_out;
2656
	strm->next_out = lastrm->next_out;
2657
	strm->avail_out = lastrm->avail_out;
2657
	strm->avail_out = (uInt)lastrm->avail_out;
2658
	strm->total_out = (uLong)lastrm->total_out;
2658
	strm->total_out = (uLong)lastrm->total_out;
2659
	if (deflateInit2(strm, level, Z_DEFLATED,
2659
	if (deflateInit2(strm, level, Z_DEFLATED,
2660
	    (withheader)?15:-15,
2660
	    (withheader)?15:-15,
Lines 2684-2693 compression_code_gzip(struct archive *a, Link Here
2684
	 * of ugly hackery to convert a const * pointer to
2684
	 * of ugly hackery to convert a const * pointer to
2685
	 * a non-const pointer. */
2685
	 * a non-const pointer. */
2686
	strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
2686
	strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
2687
	strm->avail_in = lastrm->avail_in;
2687
	strm->avail_in = (uInt)lastrm->avail_in;
2688
	strm->total_in = (uLong)lastrm->total_in;
2688
	strm->total_in = (uLong)lastrm->total_in;
2689
	strm->next_out = lastrm->next_out;
2689
	strm->next_out = lastrm->next_out;
2690
	strm->avail_out = lastrm->avail_out;
2690
	strm->avail_out = (uInt)lastrm->avail_out;
2691
	strm->total_out = (uLong)lastrm->total_out;
2691
	strm->total_out = (uLong)lastrm->total_out;
2692
	r = deflate(strm,
2692
	r = deflate(strm,
2693
	    (action == ARCHIVE_Z_FINISH)? Z_FINISH: Z_NO_FLUSH);
2693
	    (action == ARCHIVE_Z_FINISH)? Z_FINISH: Z_NO_FLUSH);
Lines 2748-2758 compression_init_encoder_bzip2(struct archive *a, Link Here
2748
	 * of ugly hackery to convert a const * pointer to
2748
	 * of ugly hackery to convert a const * pointer to
2749
	 * a non-const pointer. */
2749
	 * a non-const pointer. */
2750
	strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
2750
	strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
2751
	strm->avail_in = lastrm->avail_in;
2751
	strm->avail_in = (unsigned int)lastrm->avail_in;
2752
	strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
2752
	strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
2753
	strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
2753
	strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
2754
	strm->next_out = (char *)lastrm->next_out;
2754
	strm->next_out = (char *)lastrm->next_out;
2755
	strm->avail_out = lastrm->avail_out;
2755
	strm->avail_out = (unsigned int)lastrm->avail_out;
2756
	strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
2756
	strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
2757
	strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
2757
	strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
2758
	if (BZ2_bzCompressInit(strm, level, 0, 30) != BZ_OK) {
2758
	if (BZ2_bzCompressInit(strm, level, 0, 30) != BZ_OK) {
Lines 2781-2791 compression_code_bzip2(struct archive *a, Link Here
2781
	 * of ugly hackery to convert a const * pointer to
2781
	 * of ugly hackery to convert a const * pointer to
2782
	 * a non-const pointer. */
2782
	 * a non-const pointer. */
2783
	strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
2783
	strm->next_in = (char *)(uintptr_t)(const void *)lastrm->next_in;
2784
	strm->avail_in = lastrm->avail_in;
2784
	strm->avail_in = (unsigned int)lastrm->avail_in;
2785
	strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
2785
	strm->total_in_lo32 = (uint32_t)(lastrm->total_in & 0xffffffff);
2786
	strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
2786
	strm->total_in_hi32 = (uint32_t)(lastrm->total_in >> 32);
2787
	strm->next_out = (char *)lastrm->next_out;
2787
	strm->next_out = (char *)lastrm->next_out;
2788
	strm->avail_out = lastrm->avail_out;
2788
	strm->avail_out = (unsigned int)lastrm->avail_out;
2789
	strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
2789
	strm->total_out_lo32 = (uint32_t)(lastrm->total_out & 0xffffffff);
2790
	strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
2790
	strm->total_out_hi32 = (uint32_t)(lastrm->total_out >> 32);
2791
	r = BZ2_bzCompress(strm,
2791
	r = BZ2_bzCompress(strm,
(-)b/contrib/libarchive/libarchive/archive_write_set_format_zip.c (-5 / +5 lines)
Lines 456-462 archive_write_set_format_zip(struct archive *_a) Link Here
456
	if (a->format_free != NULL)
456
	if (a->format_free != NULL)
457
		(a->format_free)(a);
457
		(a->format_free)(a);
458
458
459
	zip = (struct zip *) calloc(1, sizeof(*zip));
459
	zip = calloc(1, sizeof(*zip));
460
	if (zip == NULL) {
460
	if (zip == NULL) {
461
		archive_set_error(&a->archive, ENOMEM,
461
		archive_set_error(&a->archive, ENOMEM,
462
		    "Can't allocate zip data");
462
		    "Can't allocate zip data");
Lines 609-615 archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) Link Here
609
		const char *p;
609
		const char *p;
610
		size_t len;
610
		size_t len;
611
611
612
		if (archive_entry_pathname_l(entry, &p, &len, sconv) != 0) {
612
		if (archive_entry_pathname_l(zip->entry, &p, &len, sconv) != 0) {
613
			if (errno == ENOMEM) {
613
			if (errno == ENOMEM) {
614
				archive_set_error(&a->archive, ENOMEM,
614
				archive_set_error(&a->archive, ENOMEM,
615
				    "Can't allocate memory for Pathname");
615
				    "Can't allocate memory for Pathname");
Lines 618-624 archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) Link Here
618
			archive_set_error(&a->archive,
618
			archive_set_error(&a->archive,
619
			    ARCHIVE_ERRNO_FILE_FORMAT,
619
			    ARCHIVE_ERRNO_FILE_FORMAT,
620
			    "Can't translate Pathname '%s' to %s",
620
			    "Can't translate Pathname '%s' to %s",
621
			    archive_entry_pathname(entry),
621
			    archive_entry_pathname(zip->entry),
622
			    archive_string_conversion_charset_name(sconv));
622
			    archive_string_conversion_charset_name(sconv));
623
			ret2 = ARCHIVE_WARN;
623
			ret2 = ARCHIVE_WARN;
624
		}
624
		}
Lines 631-637 archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) Link Here
631
		 * for filename.
631
		 * for filename.
632
		 */
632
		 */
633
		if (type == AE_IFLNK) {
633
		if (type == AE_IFLNK) {
634
			if (archive_entry_symlink_l(entry, &p, &len, sconv)) {
634
			if (archive_entry_symlink_l(zip->entry, &p, &len, sconv)) {
635
				if (errno == ENOMEM) {
635
				if (errno == ENOMEM) {
636
					archive_set_error(&a->archive, ENOMEM,
636
					archive_set_error(&a->archive, ENOMEM,
637
					    "Can't allocate memory "
637
					    "Can't allocate memory "
Lines 906-912 archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) Link Here
906
			archive_le32enc(e, (uint32_t)archive_entry_ctime(entry));
906
			archive_le32enc(e, (uint32_t)archive_entry_ctime(entry));
907
			e += 4;
907
			e += 4;
908
		}
908
		}
909
		archive_le16enc(ut + 2, e - ut - 4);
909
		archive_le16enc(ut + 2, (uint16_t)(e - ut - 4));
910
	}
910
	}
911
911
912
	/*
912
	/*
(-)b/contrib/libarchive/libarchive/test/test_7zip_filename_encoding.c (+100 lines)
Added Link Here
1
/*
2
 * Copyright (c) 2003-2018
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
#include "test.h"
27
28
DEFINE_TEST(test_7zip_filename_encoding_UTF16_win)
29
{
30
#if !defined(_WIN32) || defined(__CYGWIN__)
31
	skipping("This test is meant to verify unicode string handling"
32
		" on Windows with UTF-16 names");
33
	return;
34
#else
35
	struct archive *a;
36
	struct archive_entry *entry;
37
	char buff[4096];
38
	size_t used;
39
40
	/*
41
	 * Don't call setlocale because we're verifying that the '_w' functions
42
	 * work as expected
43
	 */
44
45
	a = archive_write_new();
46
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_7zip(a));
47
	assertEqualInt(ARCHIVE_OK,
48
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
49
50
	/* Part 1: file */
51
	entry = archive_entry_new2(a);
52
	archive_entry_copy_pathname_w(entry, L"\u8868.txt");
53
	archive_entry_set_filetype(entry, AE_IFREG);
54
	archive_entry_set_size(entry, 0);
55
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
56
57
	/* Part 2: directory */
58
	archive_entry_clear(entry);
59
	archive_entry_copy_pathname_w(entry, L"\u8868");
60
	archive_entry_set_filetype(entry, AE_IFDIR);
61
	archive_entry_set_size(entry, 0);
62
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
63
64
	/* Part 3: symlink */
65
	archive_entry_clear(entry);
66
	archive_entry_set_pathname(entry, "link.txt");
67
	archive_entry_copy_symlink_w(entry, L"\u8868.txt");
68
	archive_entry_set_filetype(entry, AE_IFLNK);
69
	archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
70
	archive_entry_set_size(entry, 0);
71
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
72
73
	/* NOTE: 7zip does not support hardlinks */
74
75
	archive_entry_free(entry);
76
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
77
78
	/* Ensure that the archive contents can be read properly */
79
	/* NOTE: 7zip file contents are not in the order we wrote them! */
80
	a = archive_read_new();
81
	archive_read_support_format_all(a);
82
	archive_read_support_filter_all(a);
83
	assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7));
84
85
	/* Read part 3: symlink */
86
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
87
	assertEqualWString(L"\u8868.txt", archive_entry_symlink_w(entry));
88
89
	/* Read part 1: file */
90
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
91
	assertEqualWString(L"\u8868.txt", archive_entry_pathname_w(entry));
92
93
	/* Read part 2: directory */
94
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
95
	/* NOTE: Trailing slash added automatically for us */
96
	assertEqualWString(L"\u8868/", archive_entry_pathname_w(entry));
97
98
	archive_read_free(a);
99
#endif
100
}
(-)b/contrib/libarchive/libarchive/test/test_ar_mode.c (+40 lines)
Added Link Here
1
/*-SPDX-License-Identifier: BSD-2-Clause
2
 * Copyright (C) 2024 by наб <nabijaczleweli@nabijaczleweli.xyz>
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
17
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 */
24
#include "test.h"
25
26
static const char data[] = "!<arch>\narchivemount.1/ 0           0     0     644     0         `\n";
27
28
29
DEFINE_TEST(test_ar_mode)
30
{
31
	struct archive * ar = archive_read_new();
32
	assertEqualInt(archive_read_support_format_all(ar), ARCHIVE_OK);
33
	assertEqualInt(archive_read_open_memory(ar, data, sizeof(data) - 1), ARCHIVE_OK);
34
35
	struct archive_entry * entry;
36
	assertEqualIntA(ar, archive_read_next_header(ar, &entry), ARCHIVE_OK);
37
	assertEqualIntA(ar, archive_entry_mode(entry), S_IFREG | 0644);
38
39
	archive_read_free(ar);
40
}
(-)b/contrib/libarchive/libarchive/test/test_archive_match_time.c (-30 / +30 lines)
Lines 316-330 test_newer_mtime_than_file_mbs(void) Link Here
316
static void
316
static void
317
test_newer_ctime_than_file_mbs(void)
317
test_newer_ctime_than_file_mbs(void)
318
{
318
{
319
#if defined(_WIN32) && !defined(__CYGWIN__)
320
	skipping("Can't set ctime on Windows");
321
	return;
322
#else
319
	struct archive *a;
323
	struct archive *a;
320
	struct archive_entry *ae;
324
	struct archive_entry *ae;
321
	struct archive *m;
325
	struct archive *m;
322
326
323
#if defined(_WIN32) && !defined(__CYGWIN__)
324
        skipping("Can't set ctime on Windows");
325
        return;
326
#endif
327
328
	if (!assert((m = archive_match_new()) != NULL))
327
	if (!assert((m = archive_match_new()) != NULL))
329
		return;
328
		return;
330
	if (!assert((ae = archive_entry_new()) != NULL)) {
329
	if (!assert((ae = archive_entry_new()) != NULL)) {
Lines 373-378 test_newer_ctime_than_file_mbs(void) Link Here
373
	archive_read_free(a);
372
	archive_read_free(a);
374
	archive_entry_free(ae);
373
	archive_entry_free(ae);
375
	archive_match_free(m);
374
	archive_match_free(m);
375
#endif
376
}
376
}
377
377
378
static void
378
static void
Lines 435-449 test_newer_mtime_than_file_wcs(void) Link Here
435
static void
435
static void
436
test_newer_ctime_than_file_wcs(void)
436
test_newer_ctime_than_file_wcs(void)
437
{
437
{
438
#if defined(_WIN32) && !defined(__CYGWIN__)
439
	skipping("Can't set ctime on Windows");
440
	return;
441
#else
438
	struct archive *a;
442
	struct archive *a;
439
	struct archive_entry *ae;
443
	struct archive_entry *ae;
440
	struct archive *m;
444
	struct archive *m;
441
445
442
#if defined(_WIN32) && !defined(__CYGWIN__)
443
        skipping("Can't set ctime on Windows");
444
        return;
445
#endif
446
447
	if (!assert((m = archive_match_new()) != NULL))
446
	if (!assert((m = archive_match_new()) != NULL))
448
		return;
447
		return;
449
	if (!assert((ae = archive_entry_new()) != NULL)) {
448
	if (!assert((ae = archive_entry_new()) != NULL)) {
Lines 493-498 test_newer_ctime_than_file_wcs(void) Link Here
493
	archive_read_free(a);
492
	archive_read_free(a);
494
	archive_entry_free(ae);
493
	archive_entry_free(ae);
495
	archive_match_free(m);
494
	archive_match_free(m);
495
#endif
496
}
496
}
497
497
498
static void
498
static void
Lines 787-801 test_older_mtime_than_file_mbs(void) Link Here
787
static void
787
static void
788
test_older_ctime_than_file_mbs(void)
788
test_older_ctime_than_file_mbs(void)
789
{
789
{
790
#if defined(_WIN32) && !defined(__CYGWIN__)
791
	skipping("Can't set ctime on Windows");
792
	return;
793
#else
790
	struct archive *a;
794
	struct archive *a;
791
	struct archive_entry *ae;
795
	struct archive_entry *ae;
792
	struct archive *m;
796
	struct archive *m;
793
797
794
#if defined(_WIN32) && !defined(__CYGWIN__)
795
        skipping("Can't set ctime on Windows");
796
        return;
797
#endif
798
799
	if (!assert((m = archive_match_new()) != NULL))
798
	if (!assert((m = archive_match_new()) != NULL))
800
		return;
799
		return;
801
	if (!assert((ae = archive_entry_new()) != NULL)) {
800
	if (!assert((ae = archive_entry_new()) != NULL)) {
Lines 845-850 test_older_ctime_than_file_mbs(void) Link Here
845
	archive_read_free(a);
844
	archive_read_free(a);
846
	archive_entry_free(ae);
845
	archive_entry_free(ae);
847
	archive_match_free(m);
846
	archive_match_free(m);
847
#endif
848
}
848
}
849
849
850
static void
850
static void
Lines 907-921 test_older_mtime_than_file_wcs(void) Link Here
907
static void
907
static void
908
test_older_ctime_than_file_wcs(void)
908
test_older_ctime_than_file_wcs(void)
909
{
909
{
910
#if defined(_WIN32) && !defined(__CYGWIN__)
911
	skipping("Can't set ctime on Windows");
912
	return;
913
#else
910
	struct archive *a;
914
	struct archive *a;
911
	struct archive_entry *ae;
915
	struct archive_entry *ae;
912
	struct archive *m;
916
	struct archive *m;
913
917
914
#if defined(_WIN32) && !defined(__CYGWIN__)
915
        skipping("Can't set ctime on Windows");
916
        return;
917
#endif
918
919
	if (!assert((m = archive_match_new()) != NULL))
918
	if (!assert((m = archive_match_new()) != NULL))
920
		return;
919
		return;
921
	if (!assert((ae = archive_entry_new()) != NULL)) {
920
	if (!assert((ae = archive_entry_new()) != NULL)) {
Lines 965-970 test_older_ctime_than_file_wcs(void) Link Here
965
	archive_read_free(a);
964
	archive_read_free(a);
966
	archive_entry_free(ae);
965
	archive_entry_free(ae);
967
	archive_match_free(m);
966
	archive_match_free(m);
967
#endif
968
}
968
}
969
969
970
static void
970
static void
Lines 1088-1102 test_mtime_between_files_wcs(void) Link Here
1088
static void
1088
static void
1089
test_ctime_between_files_mbs(void)
1089
test_ctime_between_files_mbs(void)
1090
{
1090
{
1091
#if defined(_WIN32) && !defined(__CYGWIN__)
1092
	skipping("Can't set ctime on Windows");
1093
	return;
1094
#else
1091
	struct archive *a;
1095
	struct archive *a;
1092
	struct archive_entry *ae;
1096
	struct archive_entry *ae;
1093
	struct archive *m;
1097
	struct archive *m;
1094
1098
1095
#if defined(_WIN32) && !defined(__CYGWIN__)
1096
        skipping("Can't set ctime on Windows");
1097
        return;
1098
#endif
1099
1100
	if (!assert((m = archive_match_new()) != NULL))
1099
	if (!assert((m = archive_match_new()) != NULL))
1101
		return;
1100
		return;
1102
	if (!assert((ae = archive_entry_new()) != NULL)) {
1101
	if (!assert((ae = archive_entry_new()) != NULL)) {
Lines 1147-1166 test_ctime_between_files_mbs(void) Link Here
1147
	archive_read_free(a);
1146
	archive_read_free(a);
1148
	archive_entry_free(ae);
1147
	archive_entry_free(ae);
1149
	archive_match_free(m);
1148
	archive_match_free(m);
1149
#endif
1150
}
1150
}
1151
1151
1152
static void
1152
static void
1153
test_ctime_between_files_wcs(void)
1153
test_ctime_between_files_wcs(void)
1154
{
1154
{
1155
#if defined(_WIN32) && !defined(__CYGWIN__)
1156
	skipping("Can't set ctime on Windows");
1157
	return;
1158
#else
1155
	struct archive *a;
1159
	struct archive *a;
1156
	struct archive_entry *ae;
1160
	struct archive_entry *ae;
1157
	struct archive *m;
1161
	struct archive *m;
1158
1162
1159
#if defined(_WIN32) && !defined(__CYGWIN__)
1160
        skipping("Can't set ctime on Windows");
1161
        return;
1162
#endif
1163
1164
	if (!assert((m = archive_match_new()) != NULL))
1163
	if (!assert((m = archive_match_new()) != NULL))
1165
		return;
1164
		return;
1166
	if (!assert((ae = archive_entry_new()) != NULL)) {
1165
	if (!assert((ae = archive_entry_new()) != NULL)) {
Lines 1211-1216 test_ctime_between_files_wcs(void) Link Here
1211
	archive_read_free(a);
1210
	archive_read_free(a);
1212
	archive_entry_free(ae);
1211
	archive_entry_free(ae);
1213
	archive_match_free(m);
1212
	archive_match_free(m);
1213
#endif
1214
}
1214
}
1215
1215
1216
static void
1216
static void
(-)b/contrib/libarchive/libarchive/test/test_archive_read.c (+63 lines)
Added Link Here
1
/*-
2
 * Copyright (c) 2024 Tobias Stoeckmann
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "test.h"
27
28
#define __LIBARCHIVE_TEST
29
#include "archive_read_private.h"
30
31
static char buf[1024];
32
33
DEFINE_TEST(test_archive_read_ahead_eof)
34
{
35
	struct archive *a;
36
	struct archive_read *ar;
37
	ssize_t avail;
38
39
	/* prepare a reader of raw in-memory data */
40
	assert((a = archive_read_new()) != NULL);
41
	ar = (struct archive_read *)a;
42
43
	assertA(0 == archive_read_support_format_raw(a));
44
	assertA(0 == archive_read_open_memory(a, buf, sizeof(buf)));
45
46
	/* perform a read which can be fulfilled */
47
	assert(NULL != __archive_read_ahead(ar, sizeof(buf) - 1, &avail));
48
	assertEqualInt(sizeof(buf), avail);
49
50
	/* perform a read which cannot be fulfilled due to EOF */
51
	assert(NULL == __archive_read_ahead(ar, sizeof(buf) + 1, &avail));
52
	assertEqualInt(sizeof(buf), avail);
53
54
	/* perform the same read again */
55
	assert(NULL == __archive_read_ahead(ar, sizeof(buf) + 1, &avail));
56
	assertEqualInt(sizeof(buf), avail);
57
58
	/* perform another read which can be fulfilled */
59
	assert(NULL != __archive_read_ahead(ar, sizeof(buf), &avail));
60
	assertEqualInt(sizeof(buf), avail);
61
62
	assert(0 == archive_read_free(a));
63
}
(-)b/contrib/libarchive/libarchive/test/test_archive_read_multiple_data_objects.c (-15 / +8 lines)
Lines 184-190 file_open(struct archive *a, void *data) Link Here
184
    mydata->fd = open(mydata->filename, O_RDONLY | O_BINARY);
184
    mydata->fd = open(mydata->filename, O_RDONLY | O_BINARY);
185
    if (mydata->fd >= 0)
185
    if (mydata->fd >= 0)
186
    {
186
    {
187
      if ((mydata->buffer = (void*)calloc(BLOCK_SIZE, 1)) == NULL)
187
      if ((mydata->buffer = calloc(BLOCK_SIZE, 1)) == NULL)
188
        return (ARCHIVE_FAILED);
188
        return (ARCHIVE_FAILED);
189
    }
189
    }
190
  }
190
  }
Lines 280-307 test_customized_multiple_data_objects(void) Link Here
280
280
281
  for (i = 0; filename != NULL;)
281
  for (i = 0; filename != NULL;)
282
  {
282
  {
283
    assert((mydata = (struct mydata *)calloc(1, sizeof(*mydata))) != NULL);
283
    assert((mydata = calloc(1, sizeof(*mydata))) != NULL);
284
    if (mydata == NULL) {
284
    if (mydata == NULL) {
285
      assertEqualInt(ARCHIVE_OK, archive_read_free(a));
285
      assertEqualInt(ARCHIVE_OK, archive_read_free(a));
286
      return;
286
      return;
287
    }
287
    }
288
    assert((mydata->filename =
288
    assert((mydata->filename = strdup(filename)) != NULL);
289
      (char *)calloc(strlen(filename) + 1, sizeof(char))) != NULL);
290
    if (mydata->filename == NULL) {
291
      free(mydata);
292
      assertEqualInt(ARCHIVE_OK, archive_read_free(a));
293
      return;
294
    }
295
    strcpy(mydata->filename, filename);
296
    mydata->fd = -1;
289
    mydata->fd = -1;
297
    filename = reffiles[++i];
290
    filename = reffiles[++i];
298
    assertA(0 == archive_read_append_callback_data(a, mydata));
291
    assertA(0 == archive_read_append_callback_data(a, mydata));
299
  }
292
  }
300
	assertA(0 == archive_read_set_open_callback(a, file_open));
293
  assertA(0 == archive_read_set_open_callback(a, file_open));
301
	assertA(0 == archive_read_set_read_callback(a, file_read));
294
  assertA(0 == archive_read_set_read_callback(a, file_read));
302
	assertA(0 == archive_read_set_skip_callback(a, file_skip));
295
  assertA(0 == archive_read_set_skip_callback(a, file_skip));
303
	assertA(0 == archive_read_set_close_callback(a, file_close));
296
  assertA(0 == archive_read_set_close_callback(a, file_close));
304
	assertA(0 == archive_read_set_switch_callback(a, file_switch));
297
  assertA(0 == archive_read_set_switch_callback(a, file_switch));
305
  assertA(0 == archive_read_set_seek_callback(a, file_seek));
298
  assertA(0 == archive_read_set_seek_callback(a, file_seek));
306
  assertA(0 == archive_read_open1(a));
299
  assertA(0 == archive_read_open1(a));
307
300
(-)b/contrib/libarchive/libarchive/test/test_archive_string.c (-1 / +1 lines)
Lines 405-411 DEFINE_TEST(test_archive_string_sort) Link Here
405
405
406
  srand((unsigned int)time(NULL));
406
  srand((unsigned int)time(NULL));
407
  size = sizeof(strings) / sizeof(char *);
407
  size = sizeof(strings) / sizeof(char *);
408
  assert((test_strings = (char **)calloc(size, sizeof(char *))) != NULL);
408
  assert((test_strings = calloc(size, sizeof(char *))) != NULL);
409
  for (i = 0; i < (size - 1); i++)
409
  for (i = 0; i < (size - 1); i++)
410
    assert((test_strings[i] = strdup(strings[i])) != NULL);
410
    assert((test_strings[i] = strdup(strings[i])) != NULL);
411
411
(-)b/contrib/libarchive/libarchive/test/test_archive_string_conversion.c (+135 lines)
Lines 882-884 DEFINE_TEST(test_archive_string_conversion) Link Here
882
	test_archive_string_canonicalization();
882
	test_archive_string_canonicalization();
883
	test_archive_string_set_get();
883
	test_archive_string_set_get();
884
}
884
}
885
886
DEFINE_TEST(test_archive_string_conversion_utf16_utf8)
887
{
888
#if !defined(_WIN32) || defined(__CYGWIN__)
889
	skipping("This test is meant to verify unicode string handling on Windows");
890
#else
891
	struct archive_mstring mstr;
892
	const char* utf8_string;
893
894
	memset(&mstr, 0, sizeof(mstr));
895
896
	assertEqualInt(ARCHIVE_OK,
897
	    archive_mstring_copy_wcs(&mstr, L"\U0000043f\U00000440\U00000438"));
898
899
	/* Conversion from WCS to UTF-8 should always succeed */
900
	assertEqualInt(ARCHIVE_OK,
901
	    archive_mstring_get_utf8(NULL, &mstr, &utf8_string));
902
	assertEqualString("\xD0\xBF\xD1\x80\xD0\xB8", utf8_string);
903
904
	archive_mstring_clean(&mstr);
905
#endif
906
}
907
908
DEFINE_TEST(test_archive_string_conversion_utf8_utf16)
909
{
910
#if !defined(_WIN32) || defined(__CYGWIN__)
911
	skipping("This test is meant to verify unicode string handling on Windows");
912
#else
913
	struct archive_mstring mstr;
914
	const wchar_t* wcs_string;
915
916
	memset(&mstr, 0, sizeof(mstr));
917
918
	assertEqualInt(6,
919
	    archive_mstring_copy_utf8(&mstr, "\xD0\xBF\xD1\x80\xD0\xB8"));
920
921
	/* Conversion from UTF-8 to WCS should always succeed */
922
	assertEqualInt(ARCHIVE_OK,
923
	    archive_mstring_get_wcs(NULL, &mstr, &wcs_string));
924
	assertEqualWString(L"\U0000043f\U00000440\U00000438", wcs_string);
925
926
	archive_mstring_clean(&mstr);
927
#endif
928
}
929
930
DEFINE_TEST(test_archive_string_update_utf8_win)
931
{
932
#if !defined(_WIN32) || defined(__CYGWIN__)
933
	skipping("This test is meant to verify unicode string handling on Windows"
934
	    " with the C locale");
935
#else
936
	static const char utf8_string[] = "\xD0\xBF\xD1\x80\xD0\xB8";
937
	static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
938
	struct archive_mstring mstr;
939
	int r;
940
941
	memset(&mstr, 0, sizeof(mstr));
942
943
	r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
944
945
	/* On Windows, this should reliably fail with the C locale */
946
	assertEqualInt(-1, r);
947
	assertEqualInt(0, mstr.aes_set & AES_SET_MBS);
948
949
	/* NOTE: We access the internals to validate that they were set by the
950
	 *       'archive_mstring_update_utf8' function */
951
	/* UTF-8 should always be set */
952
	assertEqualInt(AES_SET_UTF8, mstr.aes_set & AES_SET_UTF8);
953
	assertEqualString(utf8_string, mstr.aes_utf8.s);
954
	/* WCS should always be set as well */
955
	assertEqualInt(AES_SET_WCS, mstr.aes_set & AES_SET_WCS);
956
	assertEqualWString(wcs_string, mstr.aes_wcs.s);
957
958
	archive_mstring_clean(&mstr);
959
#endif
960
}
961
962
DEFINE_TEST(test_archive_string_update_utf8_utf8)
963
{
964
	static const char utf8_string[] = "\xD0\xBF\xD1\x80\xD0\xB8";
965
	static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
966
	struct archive_mstring mstr;
967
	int r;
968
969
	memset(&mstr, 0, sizeof(mstr));
970
971
	if (setlocale(LC_ALL, "en_US.UTF-8") == NULL) {
972
		skipping("UTF-8 not supported on this system.");
973
		return;
974
	}
975
976
	r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
977
978
	/* All conversions should have succeeded */
979
	assertEqualInt(0, r);
980
	assertEqualInt(AES_SET_MBS | AES_SET_WCS | AES_SET_UTF8, mstr.aes_set);
981
	assertEqualString(utf8_string, mstr.aes_utf8.s);
982
	assertEqualString(utf8_string, mstr.aes_mbs.s);
983
	assertEqualWString(wcs_string, mstr.aes_wcs.s);
984
985
	archive_mstring_clean(&mstr);
986
}
987
988
DEFINE_TEST(test_archive_string_update_utf8_koi8)
989
{
990
	static const char utf8_string[] = "\xD0\xBF\xD1\x80\xD0\xB8";
991
	static const char koi8_string[] = "\xD0\xD2\xC9";
992
	static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
993
	struct archive_mstring mstr;
994
	int r;
995
996
	memset(&mstr, 0, sizeof(mstr));
997
998
	if (setlocale(LC_ALL, "ru_RU.KOI8-R") == NULL) {
999
		skipping("KOI8-R locale not available on this system.");
1000
		return;
1001
	}
1002
1003
	r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);
1004
1005
	/* All conversions should have succeeded */
1006
	assertEqualInt(0, r);
1007
	assertEqualInt(AES_SET_MBS | AES_SET_WCS | AES_SET_UTF8, mstr.aes_set);
1008
	assertEqualString(utf8_string, mstr.aes_utf8.s);
1009
	assertEqualString(koi8_string, mstr.aes_mbs.s);
1010
#if defined(_WIN32) && !defined(__CYGWIN__)
1011
	assertEqualWString(wcs_string, mstr.aes_wcs.s);
1012
#else
1013
	/* No guarantee of how WCS strings behave, however this test test is
1014
	 * primarily meant for Windows */
1015
	(void)wcs_string;
1016
#endif
1017
1018
	archive_mstring_clean(&mstr);
1019
}
(-)b/contrib/libarchive/libarchive/test/test_archive_write_add_filter_by_name.c (-1 / +1 lines)
Lines 36-42 test_filter_by_name(const char *filter_name, int filter_code, Link Here
36
	char *buff;
36
	char *buff;
37
	int r;
37
	int r;
38
38
39
	assert((buff = calloc(buffsize, sizeof(char))) != NULL);
39
	assert((buff = calloc(buffsize, sizeof(*buff))) != NULL);
40
	if (buff == NULL)
40
	if (buff == NULL)
41
		return;
41
		return;
42
42
(-)b/contrib/libarchive/libarchive/test/test_compat_lzip.c (-1 / +1 lines)
Lines 47-53 echo "f3" > $dir/d1/f3 Link Here
47
rm -r $dir
47
rm -r $dir
48
}
48
}
49
#
49
#
50
# Make a lzip file from splitted tar file.
50
# Make a lzip file from split tar file.
51
#
51
#
52
name=test_compat_lzip_1
52
name=test_compat_lzip_1
53
dir="$name`date +%Y%m%d%H%M%S`.$USER"
53
dir="$name`date +%Y%m%d%H%M%S`.$USER"
(-)b/contrib/libarchive/libarchive/test/test_compat_solaris_pax_sparse.c (-1 / +1 lines)
Lines 60-66 test_compat_solaris_pax_sparse_1(void) Link Here
60
	assertEqualInt(0100644, archive_entry_mode(ae));
60
	assertEqualInt(0100644, archive_entry_mode(ae));
61
61
62
	/* Verify the sparse information. */
62
	/* Verify the sparse information. */
63
	failure("This sparse file should have tree data blocks");
63
	failure("This sparse file should have three data blocks");
64
	assertEqualInt(3, archive_entry_sparse_reset(ae));
64
	assertEqualInt(3, archive_entry_sparse_reset(ae));
65
	assertEqualInt(ARCHIVE_OK,
65
	assertEqualInt(ARCHIVE_OK,
66
	    archive_entry_sparse_next(ae, &offset, &length));
66
	    archive_entry_sparse_next(ae, &offset, &length));
(-)b/contrib/libarchive/libarchive/test/test_entry.c (-4 / +10 lines)
Lines 269-275 DEFINE_TEST(test_entry) Link Here
269
	archive_entry_set_hardlink(e, "hardlink");
269
	archive_entry_set_hardlink(e, "hardlink");
270
	archive_entry_set_symlink(e, "symlink");
270
	archive_entry_set_symlink(e, "symlink");
271
	archive_entry_set_link(e, "link");
271
	archive_entry_set_link(e, "link");
272
	assertEqualString(archive_entry_hardlink(e), "hardlink");
272
	assertEqualString(archive_entry_hardlink(e), NULL);
273
	assertEqualString(archive_entry_symlink(e), "link");
273
	assertEqualString(archive_entry_symlink(e), "link");
274
274
275
	/* mode */
275
	/* mode */
Lines 513-519 DEFINE_TEST(test_entry) Link Here
513
	archive_entry_set_rdev(e, 532);
513
	archive_entry_set_rdev(e, 532);
514
	archive_entry_set_size(e, 987654321);
514
	archive_entry_set_size(e, 987654321);
515
	archive_entry_copy_sourcepath(e, "source");
515
	archive_entry_copy_sourcepath(e, "source");
516
	archive_entry_set_symlink(e, "symlinkname");
517
	archive_entry_set_uid(e, 83);
516
	archive_entry_set_uid(e, 83);
518
	archive_entry_set_uname(e, "user");
517
	archive_entry_set_uname(e, "user");
519
	/* Add an ACL entry. */
518
	/* Add an ACL entry. */
Lines 548-554 DEFINE_TEST(test_entry) Link Here
548
	assertEqualInt(archive_entry_rdev(e2), 532);
547
	assertEqualInt(archive_entry_rdev(e2), 532);
549
	assertEqualInt(archive_entry_size(e2), 987654321);
548
	assertEqualInt(archive_entry_size(e2), 987654321);
550
	assertEqualString(archive_entry_sourcepath(e2), "source");
549
	assertEqualString(archive_entry_sourcepath(e2), "source");
551
	assertEqualString(archive_entry_symlink(e2), "symlinkname");
550
	assertEqualString(archive_entry_symlink(e2), NULL);
552
	assertEqualInt(archive_entry_uid(e2), 83);
551
	assertEqualInt(archive_entry_uid(e2), 83);
553
	assertEqualString(archive_entry_uname(e2), "user");
552
	assertEqualString(archive_entry_uname(e2), "user");
554
553
Lines 649-655 DEFINE_TEST(test_entry) Link Here
649
	assertEqualInt(archive_entry_rdev(e2), 532);
648
	assertEqualInt(archive_entry_rdev(e2), 532);
650
	assertEqualInt(archive_entry_size(e2), 987654321);
649
	assertEqualInt(archive_entry_size(e2), 987654321);
651
	assertEqualString(archive_entry_sourcepath(e2), "source");
650
	assertEqualString(archive_entry_sourcepath(e2), "source");
652
	assertEqualString(archive_entry_symlink(e2), "symlinkname");
651
	assertEqualString(archive_entry_symlink(e2), NULL);
653
	assertEqualInt(archive_entry_uid(e2), 83);
652
	assertEqualInt(archive_entry_uid(e2), 83);
654
	assertEqualString(archive_entry_uname(e2), "user");
653
	assertEqualString(archive_entry_uname(e2), "user");
655
654
Lines 705-710 DEFINE_TEST(test_entry) Link Here
705
	/* Release clone. */
704
	/* Release clone. */
706
	archive_entry_free(e2);
705
	archive_entry_free(e2);
707
706
707
	/* Verify that symlink is copied over by `clone` */
708
	archive_entry_set_symlink(e, "symlinkpath");
709
	e2 = archive_entry_clone(e);
710
	assertEqualString(archive_entry_hardlink(e2), NULL);
711
	assertEqualString(archive_entry_symlink(e2), "symlinkpath");
712
	archive_entry_free(e2);
713
708
	/*
714
	/*
709
	 * Test clear() implementation.
715
	 * Test clear() implementation.
710
	 */
716
	 */
(-)b/contrib/libarchive/libarchive/test/test_gnutar_filename_encoding.c (+102 lines)
Lines 389-391 DEFINE_TEST(test_gnutar_filename_encoding_CP932_UTF8) Link Here
389
	assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
389
	assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
390
}
390
}
391
391
392
DEFINE_TEST(test_gnutar_filename_encoding_UTF16_win)
393
{
394
#if !defined(_WIN32) || defined(__CYGWIN__)
395
	skipping("This test is meant to verify unicode string handling"
396
		" on Windows with UTF-16 names");
397
	return;
398
#else
399
	struct archive *a;
400
	struct archive_entry *entry;
401
	char buff[4096];
402
	size_t used;
403
404
	/*
405
	 * Don't call setlocale because we're verifying that the '_w' functions
406
	 * work as expected when 'hdrcharset' is UTF-8
407
	 */
408
409
	/* Part 1: file */
410
	a = archive_write_new();
411
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
412
	if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
413
		skipping("This system cannot convert character-set"
414
		    " from UTF-16 to UTF-8.");
415
		archive_write_free(a);
416
		return;
417
	}
418
	assertEqualInt(ARCHIVE_OK,
419
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
420
421
	entry = archive_entry_new2(a);
422
	/* Set the filename using a UTF-16 string */
423
	archive_entry_copy_pathname_w(entry, L"\u8868.txt");
424
	archive_entry_set_filetype(entry, AE_IFREG);
425
	archive_entry_set_size(entry, 0);
426
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
427
	archive_entry_free(entry);
428
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
429
430
	/* Check UTF-8 version. */
431
	assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
432
433
	/* Part 2: directory */
434
	a = archive_write_new();
435
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
436
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
437
	assertEqualInt(ARCHIVE_OK,
438
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
439
440
	entry = archive_entry_new2(a);
441
	/* Set the directory name using a UTF-16 string */
442
	/* NOTE: Explicitly not adding trailing slash to test that code path */
443
	archive_entry_copy_pathname_w(entry, L"\u8868");
444
	archive_entry_set_filetype(entry, AE_IFDIR);
445
	archive_entry_set_size(entry, 0);
446
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
447
	archive_entry_free(entry);
448
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
449
450
	/* Check UTF-8 version. */
451
	assertEqualMem(buff, "\xE8\xA1\xA8/", 4);
452
453
	/* Part 3: symlink */
454
	a = archive_write_new();
455
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
456
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
457
	assertEqualInt(ARCHIVE_OK,
458
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
459
460
	entry = archive_entry_new2(a);
461
	/* Set the symlink target using a UTF-16 string */
462
	archive_entry_set_pathname(entry, "link.txt");
463
	archive_entry_copy_symlink_w(entry, L"\u8868.txt");
464
	archive_entry_set_filetype(entry, AE_IFLNK);
465
	archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
466
	archive_entry_set_size(entry, 0);
467
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
468
	archive_entry_free(entry);
469
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
470
471
	/* Check UTF-8 version. */
472
	assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
473
474
	/* Part 4: hardlink */
475
	a = archive_write_new();
476
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_gnutar(a));
477
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
478
	assertEqualInt(ARCHIVE_OK,
479
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
480
481
	entry = archive_entry_new2(a);
482
	/* Set the symlink target using a UTF-16 string */
483
	archive_entry_set_pathname(entry, "link.txt");
484
	archive_entry_copy_hardlink_w(entry, L"\u8868.txt");
485
	archive_entry_set_size(entry, 0);
486
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
487
	archive_entry_free(entry);
488
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
489
490
	/* Check UTF-8 version. */
491
	assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
492
#endif
493
}
(-)b/contrib/libarchive/libarchive/test/test_link_resolver.c (+45 lines)
Lines 202-204 DEFINE_TEST(test_link_resolver) Link Here
202
	test_linkify_old_cpio();
202
	test_linkify_old_cpio();
203
	test_linkify_new_cpio();
203
	test_linkify_new_cpio();
204
}
204
}
205
206
DEFINE_TEST(test_link_resolver_unicode_win)
207
{
208
#if !defined(_WIN32) || defined(__CYGWIN__)
209
	skipping("This test is meant to verify unicode string handling"
210
	    " on Windows with UTF-16 names");
211
	return;
212
#else
213
	struct archive_entry *entry, *e2;
214
	struct archive_entry_linkresolver *resolver;
215
216
	/* Initialize the resolver. */
217
	assert(NULL != (resolver = archive_entry_linkresolver_new()));
218
	archive_entry_linkresolver_set_strategy(resolver,
219
	    ARCHIVE_FORMAT_TAR_USTAR);
220
221
	/* Create an entry with a unicode filename and 2 links. */
222
	assert(NULL != (entry = archive_entry_new()));
223
	archive_entry_copy_pathname_w(entry, L"\u4f60\u597d.txt");
224
	archive_entry_set_ino(entry, 1);
225
	archive_entry_set_dev(entry, 2);
226
	archive_entry_set_nlink(entry, 2);
227
	archive_entry_set_size(entry, 10);
228
	archive_entry_linkify(resolver, &entry, &e2);
229
230
	/* Shouldn't be altered, since it wasn't seen before. */
231
	assert(e2 == NULL);
232
	assertEqualWString(L"\u4f60\u597d.txt", archive_entry_pathname_w(entry));
233
	assertEqualWString(NULL, archive_entry_hardlink_w(entry));
234
	assertEqualInt(10, archive_entry_size(entry));
235
236
	/* Link to the same file contents, but a new unicode name. */
237
	archive_entry_copy_pathname_w(entry, L"\u518d\u89c1.txt");
238
	archive_entry_linkify(resolver, &entry, &e2);
239
240
	/* Size & link path should have changed. */
241
	assert(e2 == NULL);
242
	assertEqualWString(L"\u518d\u89c1.txt", archive_entry_pathname_w(entry));
243
	assertEqualWString(L"\u4f60\u597d.txt", archive_entry_hardlink_w(entry));
244
	assertEqualInt(0, archive_entry_size(entry));
245
246
	archive_entry_free(entry);
247
	archive_entry_linkresolver_free(resolver);
248
#endif
249
}
(-)b/contrib/libarchive/libarchive/test/test_pax_filename_encoding.c (+152 lines)
Lines 579-584 DEFINE_TEST(test_pax_filename_encoding_KOI8R_CP1251) Link Here
579
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
579
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
580
}
580
}
581
581
582
/*
583
 * Verify that unicode filenames are correctly preserved on Windows
584
 */
585
DEFINE_TEST(test_pax_filename_encoding_UTF16_win)
586
{
587
#if !defined(_WIN32) || defined(__CYGWIN__)
588
	skipping("This test is meant to verify unicode string handling"
589
		" on Windows with UTF-16 names");
590
	return;
591
#else
592
	struct archive *a;
593
	struct archive_entry *entry;
594
	char buff[0x2000];
595
	char *p;
596
	size_t used;
597
598
	/*
599
	 * Don't call setlocale because we're verifying that the '_w' functions
600
	 * work as expected when 'hdrcharset' is UTF-8
601
	 */
602
603
	/* Check if the platform completely supports the string conversion. */
604
	a = archive_write_new();
605
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
606
	if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
607
		skipping("This system cannot convert character-set"
608
		    " from UTF-16 to UTF-8.");
609
		archive_write_free(a);
610
		return;
611
	}
612
	archive_write_free(a);
613
614
	/*
615
	 * Create a new archive handle with default charset handling
616
	 */
617
	a = archive_write_new();
618
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
619
	assertEqualInt(ARCHIVE_OK,
620
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
621
622
	/* Part 1: file */
623
	entry = archive_entry_new2(a);
624
	archive_entry_copy_pathname_w(entry, L"\u4f60\u597d.txt");
625
	archive_entry_set_filetype(entry, AE_IFREG);
626
	archive_entry_set_size(entry, 0);
627
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
628
629
	/* Part 2: directory */
630
	/* NOTE: Explicitly not adding trailing slash to test that code path */
631
	archive_entry_copy_pathname_w(entry, L"\u043f\u0440\u0438");
632
	archive_entry_set_filetype(entry, AE_IFDIR);
633
	archive_entry_set_size(entry, 0);
634
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
635
636
	/* Part 3: symlink */
637
	archive_entry_copy_pathname_w(entry, L"\u518d\u89c1.txt");
638
	archive_entry_copy_symlink_w(entry, L"\u4f60\u597d.txt");
639
	archive_entry_set_filetype(entry, AE_IFLNK);
640
	archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
641
	archive_entry_set_size(entry, 0);
642
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
643
644
	/* Part 4: hardlink */
645
	archive_entry_copy_pathname_w(entry, L"\u665a\u5b89.txt");
646
	archive_entry_copy_hardlink_w(entry, L"\u4f60\u597d.txt");
647
	archive_entry_set_filetype(entry, AE_IFREG);
648
	archive_entry_set_size(entry, 0);
649
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
650
651
	archive_entry_free(entry);
652
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
653
654
	/*
655
	 * Examine the bytes to ensure the filenames ended up UTF-8
656
	 * encoded as we expect.
657
	 */
658
659
	/* Part 1: file */
660
	p = buff + 0;
661
	assertEqualString(p + 0, "PaxHeader/\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* File name */
662
	assertEqualInt(p[156], 'x'); /* Pax extension header */
663
	p += 512; /* Pax extension body */
664
	assertEqualString(p + 0, "19 path=\xE4\xBD\xA0\xE5\xA5\xBD.txt\n");
665
	p += 512; /* Ustar header */
666
	assertEqualString(p + 0, "\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* File name */
667
	assertEqualInt(p[156], '0');
668
669
	/* Part 2: directory */
670
	p += 512; /* Pax extension header */
671
	assertEqualString(p + 0, "PaxHeader/\xD0\xBF\xD1\x80\xD0\xB8"); /* File name */
672
	assertEqualInt(p[156], 'x');
673
	p += 512; /* Pax extension body */
674
	assertEqualString(p + 0, "16 path=\xD0\xBF\xD1\x80\xD0\xB8/\n");
675
	p += 512; /* Ustar header */
676
	assertEqualString(p + 0, "\xD0\xBF\xD1\x80\xD0\xB8/"); /* File name */
677
	assertEqualInt(p[156], '5'); /* directory */
678
679
	/* Part 3: symlink */
680
	p += 512; /* Pax Extension Header */
681
	assertEqualString(p + 0, "PaxHeader/\xE5\x86\x8D\xE8\xA7\x81.txt"); /* File name */
682
	p += 512; /* Pax extension body */
683
	assertEqualString(p + 0,
684
			  "19 path=\xE5\x86\x8D\xE8\xA7\x81.txt\n"
685
			  "23 linkpath=\xE4\xBD\xA0\xE5\xA5\xBD.txt\n"
686
			  "31 LIBARCHIVE.symlinktype=file\n");
687
	p += 512; /* Ustar header */
688
	assertEqualString(p + 0, "\xE5\x86\x8D\xE8\xA7\x81.txt"); /* File name */
689
	assertEqualInt(p[156], '2'); /* symlink */
690
	assertEqualString(p + 157, "\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* link name */
691
692
	/* Part 4: hardlink */
693
	p += 512; /* Pax extension header */
694
	assertEqualString(p + 0, "PaxHeader/\xE6\x99\x9A\xE5\xAE\x89.txt"); /* File name */
695
	p += 512; /* Pax extension body */
696
	assertEqualString(p + 0,
697
			  "19 path=\xE6\x99\x9A\xE5\xAE\x89.txt\n"
698
			  "23 linkpath=\xE4\xBD\xA0\xE5\xA5\xBD.txt\n"
699
			  "31 LIBARCHIVE.symlinktype=file\n");
700
	p += 512; /* Ustar header */
701
	assertEqualString(p + 0, "\xE6\x99\x9A\xE5\xAE\x89.txt"); /* File name */
702
	assertEqualInt(p[156], '1'); /* hard link */
703
	assertEqualString(p + 157, "\xE4\xBD\xA0\xE5\xA5\xBD.txt"); /* link name */
704
705
	/*
706
	 * Read back the archive to see if we get the original names
707
	 */
708
	a = archive_read_new();
709
	archive_read_support_format_all(a);
710
	archive_read_support_filter_all(a);
711
	assertEqualInt(0, archive_read_open_memory(a, buff, used));
712
713
	/* Read part 1: file */
714
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
715
	assertEqualWString(L"\u4f60\u597d.txt", archive_entry_pathname_w(entry));
716
717
	/* Read part 2: directory */
718
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
719
	assertEqualWString(L"\u043f\u0440\u0438/", archive_entry_pathname_w(entry));
720
721
	/* Read part 3: symlink */
722
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
723
	assertEqualWString(L"\u518d\u89c1.txt", archive_entry_pathname_w(entry));
724
	assertEqualWString(L"\u4f60\u597d.txt", archive_entry_symlink_w(entry));
725
726
	/* Read part 4: hardlink */
727
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &entry));
728
	assertEqualWString(L"\u665a\u5b89.txt", archive_entry_pathname_w(entry));
729
	assertEqualWString(L"\u4f60\u597d.txt", archive_entry_hardlink_w(entry));
730
731
	archive_free(a);
732
#endif
733
}
582
734
583
DEFINE_TEST(test_pax_filename_encoding)
735
DEFINE_TEST(test_pax_filename_encoding)
584
{
736
{
(-)b/contrib/libarchive/libarchive/test/test_read_filter_gzip_recursive.c (+50 lines)
Added Link Here
1
/*-
2
 * Copyright (c) 2003-2024 Tim Kientzle
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
#include "test.h"
26
27
DEFINE_TEST(test_read_filter_gzip_recursive)
28
{
29
	const char *name = "test_read_filter_gzip_recursive.gz";
30
	struct archive *a;
31
32
	if (!canGzip()) {
33
		skipping("gzip not available");
34
		return;
35
	}
36
37
	assert((a = archive_read_new()) != NULL);
38
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
39
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
40
	extract_reference_file(name);
41
	assertEqualIntA(a, ARCHIVE_FATAL,
42
	    archive_read_open_filename(a, name, 200));
43
44
	/* Verify that the filter detection worked. */
45
	assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_GZIP);
46
	assertEqualString(archive_filter_name(a, 0), "gzip");
47
48
	assertEqualInt(ARCHIVE_OK, archive_read_close(a));
49
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
50
}
(-)b/contrib/libarchive/libarchive/test/test_read_filter_gzip_recursive.gz.uu (+19 lines)
Added Link Here
1
From oss-fuzz:
2
3
clusterfuzz-testcase-minimized-libarchive_fuzzer-5138261947580416
4
5
This is a gzip input that expands to a gzip, etc, in such a way that
6
the "filename" field in the nested gzip header ends up being extremely
7
large (> 500 MiB).  This caused headaches for the gzip filter before I
8
implemented a sanity limit on filename and comment sizes.
9
10
begin 644 test_read_filter_gzip_recursive.gz
11
M'XL(`5`M[_<\`'#_``#_'XL("0!D0`GK_W,)&P!P_P``_Q^+"`@(`%$`"0D<
12
M`'#_``#_'XL($?\'_^_W/`!P_P``_Q^+"`D`9$`)Z_]S[AL`</\``/\?BP@(
13
M"`!1``D)'`!P_P``_Q^+"!'_!___ZP$)=Q'_!___<PD;`'#_``#_'XL("`@`
14
M40`)"1P`</\``/\?BP@1_P?_[_<\`'#_``#_'XL("0!D0`GK_SP`</\``/\?
15
MBP@)`&1`">O_<^YC:&$!"7<1_P?__W,)&P!P_P``_Q^+"`@(`%$`"0D<`'#_
16
M``#_'XL($?\'_^_W/`!P_P``_Q^+"`D`9$`)Z_\\@</"P\/#P\/#P\/!P\/#
17
7P\/#P\/#P\/EP\/#B`$`PT.?"`M=P\,`
18
`
19
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_7zip.c (+44 lines)
Lines 1050-1055 test_arm_filter(const char *refname) Link Here
1050
1050
1051
	extract_reference_file(refname);
1051
	extract_reference_file(refname);
1052
1052
1053
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
1053
	assert((a = archive_read_new()) != NULL);
1054
	assert((a = archive_read_new()) != NULL);
1054
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
1055
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
1055
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
1056
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
Lines 1123-1128 test_arm64_filter(const char *refname) Link Here
1123
1124
1124
	extract_reference_file(refname);
1125
	extract_reference_file(refname);
1125
1126
1127
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
1126
	assert((a = archive_read_new()) != NULL);
1128
	assert((a = archive_read_new()) != NULL);
1127
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
1129
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
1128
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
1130
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
Lines 1255-1259 DEFINE_TEST(test_read_format_7zip_win_attrib) Link Here
1255
	assertEqualString("system", archive_entry_fflags_text(ae));
1257
	assertEqualString("system", archive_entry_fflags_text(ae));
1256
1258
1257
1259
1260
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
1261
}
1262
1263
DEFINE_TEST(test_read_format_7zip_extract_second)
1264
{
1265
	struct archive *a;
1266
	char buffer[256];
1267
1268
	assert((a = archive_read_new()) != NULL);
1269
1270
	if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
1271
		skipping(
1272
		    "7zip:lzma decoding is not supported on this platform");
1273
		assertEqualInt(ARCHIVE_OK, archive_read_free(a));
1274
		return;
1275
	}
1276
1277
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
1278
1279
	/*
1280
	 * The test archive has two files: first.txt which is a 65,536 file (the
1281
	 * size of the uncompressed buffer), and second.txt which has contents
1282
	 * we will validate. This test ensures we can skip first.txt and still
1283
	 * be able to read the contents of second.txt
1284
	 */
1285
	const char *refname = "test_read_format_7zip_extract_second.7z";
1286
	extract_reference_file(refname);
1287
1288
	assertEqualIntA(a, ARCHIVE_OK,
1289
		archive_read_open_filename(a, refname, 10240));
1290
1291
	struct archive_entry *ae;
1292
1293
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
1294
	assertEqualString("first.txt", archive_entry_pathname(ae));
1295
1296
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
1297
	assertEqualString("second.txt", archive_entry_pathname(ae));
1298
1299
	assertEqualInt(23, archive_read_data(a, buffer, sizeof(buffer)));
1300
	assertEqualMem("This is from second.txt", buffer, 23);
1301
1258
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
1302
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
1259
}
1303
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_7zip_extract_second.7z.uu (+11 lines)
Added Link Here
1
begin 644 test_read_format_7zip_extract_second.7z
2
M-WJ\KR<<``-N%=VX!@$````````B`````````*R\U.<`&`Q"DFIGO`[1,RO\
3
MN,RA7-QU1L&_]O_/$0MMLIEBUR3'BDX@M2C-5'VG./-4,5@W3Q@*__^7_,[H
4
MEO`DB'[ZI>@H2_E>/W.2G$$.P01-X!YN5";SS[3#7Z4Q1G/EF.0'^D*[S8&8
5
M[FV9DYX7,SA%^.Q\'?__P!@`````@3,'K@_4WV/Q0A7VLXG$X?GH4=5W^`UM
6
M$N_EX$)LE*?K$W5?WLP:X0T[Q%V^?A!0E\VZRBB,)(MO`C`LO[O!3(1YL)<:
7
MJ."`';WU;>GP5',%Z=6?*/H9*Z)&\*!2^<F\P&>,RV`R30UOBH8+5.;;2IKF
8
M0W://&'?"L?0L2!)`*]F30B0&/_'<4``%P9Z`0F`C``'"P$``2,#`0$%70``
9
-@``,@*@*`6]FB2D`````
10
`
11
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_cpio_afio.c (-11 / +19 lines)
Lines 65-79 static unsigned char archive[] = { Link Here
65
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
65
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
66
};
66
};
67
67
68
/*
69
 * XXX This must be removed when we use int64_t for uid.
70
 */
71
static int
72
uid_size(void)
73
{
74
	return (sizeof(uid_t));
75
}
76
77
DEFINE_TEST(test_read_format_cpio_afio)
68
DEFINE_TEST(test_read_format_cpio_afio)
78
{
69
{
79
	unsigned char *p;
70
	unsigned char *p;
Lines 106-113 DEFINE_TEST(test_read_format_cpio_afio) Link Here
106
	 */
97
	 */
107
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
98
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
108
	assertEqualInt(17, archive_entry_size(ae));
99
	assertEqualInt(17, archive_entry_size(ae));
109
	if (uid_size() > 4)
100
	assertEqualInt(65536, archive_entry_uid(ae));
110
		assertEqualInt(65536, archive_entry_uid(ae));
111
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
101
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
112
	assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
102
	assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
113
	assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
103
	assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE);
Lines 117-119 DEFINE_TEST(test_read_format_cpio_afio) Link Here
117
107
118
	free(p);
108
	free(p);
119
}
109
}
110
111
// From OSS Fuzz Issue 70019:
112
static unsigned char archive2[] = "070727bbbBbbbBabbbbbbcbcbbbbbbm726f777f777ffffffff518402ffffbbbabDDDDDDDDD7c7Ddd7DDDDnDDDdDDDB7777s77777777777C7727:";
113
114
DEFINE_TEST(test_read_format_cpio_afio_broken)
115
{
116
	struct archive *a;
117
	struct archive_entry *ae;
118
119
	assert((a = archive_read_new()) != NULL);
120
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
121
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
122
	assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive2, sizeof(archive2)));
123
	assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
124
	assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE);
125
	assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_AFIO_LARGE);
126
	archive_read_free(a);
127
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_huge_rpm.c (+50 lines)
Added Link Here
1
/*-
2
 * Copyright (c) 2003-2024 Tim Kientzle
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
#include "test.h"
26
27
DEFINE_TEST(test_read_format_huge_rpm)
28
{
29
	struct archive_entry *ae;
30
	struct archive *a;
31
	const char *name = "test_read_format_huge_rpm.rpm";
32
33
	assert((a = archive_read_new()) != NULL);
34
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
35
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
36
	extract_reference_file(name);
37
	assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 2));
38
39
	/* This archive should have no entries -- if it has entries, the bid has screwed up */
40
	assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
41
42
	/* Verify that the format detection worked. */
43
	assertEqualInt(ARCHIVE_FILTER_RPM, archive_filter_code(a, 0));
44
	assertEqualString("rpm", archive_filter_name(a, 0));
45
	assertEqualInt(ARCHIVE_FORMAT_EMPTY, archive_format(a));
46
47
	assertEqualInt(ARCHIVE_OK, archive_read_close(a));
48
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
49
}
50
(-)b/contrib/libarchive/libarchive/test/test_read_format_huge_rpm.rpm.uu (+244 lines)
Added Link Here
1
(
2
	# set up ST_LEAD
3
	python -c 'import sys; sys.stdout.buffer.write(b"\xED\xAB\xEE\xDB\x03\x00\x00\x01" + (96 - 8) * b"\x00")'
4
	# set up ST_HEADER with 0x800000 sections
5
	python -c 'import sys; sys.stdout.buffer.write(b"\x8E\xAD\xE8\x01" + 4 * b"\x00" + b"\x80" + 7 * b"\x00")'
6
	# create archive
7
	touch input.txt
8
	bsdtar -cf - input.txt
9
) > test_read_format_huge_rpm.rpm
10
11
begin 644 test_read_format_huge_rpm.rpm
12
M[:ONVP,```$`````````````````````````````````````````````````
13
M````````````````````````````````````````````````````````````
14
M````````CJWH`0````"``````````&EN<'5T+G1X=```````````````````
15
M````````````````````````````````````````````````````````````
16
M```````````````````````````````````````````P,#`V-#0@`#`P,#<V
17
M-2``,#`P,#(T(``P,#`P,#`P,#`P,"`Q-#8Q-3(U-C0W-"`P,3(W,38`(#``
18
M````````````````````````````````````````````````````````````
19
M````````````````````````````````````````````````````````````
20
M````````````=7-T87(`,#!T:6T`````````````````````````````````
21
M`````'-T869F````````````````````````````````````,#`P,#`P(``P
22
M,#`P,#`@````````````````````````````````````````````````````
23
M````````````````````````````````````````````````````````````
24
M````````````````````````````````````````````````````````````
25
M````````````````````````````````````````````````````````````
26
M````````````````````````````````````````````````````````````
27
M````````````````````````````````````````````````````````````
28
M````````````````````````````````````````````````````````````
29
M````````````````````````````````````````````````````````````
30
M````````````````````````````````````````````````````````````
31
M````````````````````````````````````````````````````````````
32
M````````````````````````````````````````````````````````````
33
M````````````````````````````````````````````````````````````
34
M````````````````````````````````````````````````````````````
35
M````````````````````````````````````````````````````````````
36
M````````````````````````````````````````````````````````````
37
M````````````````````````````````````````````````````````````
38
M````````````````````````````````````````````````````````````
39
M````````````````````````````````````````````````````````````
40
M````````````````````````````````````````````````````````````
41
M````````````````````````````````````````````````````````````
42
M````````````````````````````````````````````````````````````
43
M````````````````````````````````````````````````````````````
44
M````````````````````````````````````````````````````````````
45
M````````````````````````````````````````````````````````````
46
M````````````````````````````````````````````````````````````
47
M````````````````````````````````````````````````````````````
48
M````````````````````````````````````````````````````````````
49
M````````````````````````````````````````````````````````````
50
M````````````````````````````````````````````````````````````
51
M````````````````````````````````````````````````````````````
52
M````````````````````````````````````````````````````````````
53
M````````````````````````````````````````````````````````````
54
M````````````````````````````````````````````````````````````
55
M````````````````````````````````````````````````````````````
56
M````````````````````````````````````````````````````````````
57
M````````````````````````````````````````````````````````````
58
M````````````````````````````````````````````````````````````
59
M````````````````````````````````````````````````````````````
60
M````````````````````````````````````````````````````````````
61
M````````````````````````````````````````````````````````````
62
M````````````````````````````````````````````````````````````
63
M````````````````````````````````````````````````````````````
64
M````````````````````````````````````````````````````````````
65
M````````````````````````````````````````````````````````````
66
M````````````````````````````````````````````````````````````
67
M````````````````````````````````````````````````````````````
68
M````````````````````````````````````````````````````````````
69
M````````````````````````````````````````````````````````````
70
M````````````````````````````````````````````````````````````
71
M````````````````````````````````````````````````````````````
72
M````````````````````````````````````````````````````````````
73
M````````````````````````````````````````````````````````````
74
M````````````````````````````````````````````````````````````
75
M````````````````````````````````````````````````````````````
76
M````````````````````````````````````````````````````````````
77
M````````````````````````````````````````````````````````````
78
M````````````````````````````````````````````````````````````
79
M````````````````````````````````````````````````````````````
80
M````````````````````````````````````````````````````````````
81
M````````````````````````````````````````````````````````````
82
M````````````````````````````````````````````````````````````
83
M````````````````````````````````````````````````````````````
84
M````````````````````````````````````````````````````````````
85
M````````````````````````````````````````````````````````````
86
M````````````````````````````````````````````````````````````
87
M````````````````````````````````````````````````````````````
88
M````````````````````````````````````````````````````````````
89
M````````````````````````````````````````````````````````````
90
M````````````````````````````````````````````````````````````
91
M````````````````````````````````````````````````````````````
92
M````````````````````````````````````````````````````````````
93
M````````````````````````````````````````````````````````````
94
M````````````````````````````````````````````````````````````
95
M````````````````````````````````````````````````````````````
96
M````````````````````````````````````````````````````````````
97
M````````````````````````````````````````````````````````````
98
M````````````````````````````````````````````````````````````
99
M````````````````````````````````````````````````````````````
100
M````````````````````````````````````````````````````````````
101
M````````````````````````````````````````````````````````````
102
M````````````````````````````````````````````````````````````
103
M````````````````````````````````````````````````````````````
104
M````````````````````````````````````````````````````````````
105
M````````````````````````````````````````````````````````````
106
M````````````````````````````````````````````````````````````
107
M````````````````````````````````````````````````````````````
108
M````````````````````````````````````````````````````````````
109
M````````````````````````````````````````````````````````````
110
M````````````````````````````````````````````````````````````
111
M````````````````````````````````````````````````````````````
112
M````````````````````````````````````````````````````````````
113
M````````````````````````````````````````````````````````````
114
M````````````````````````````````````````````````````````````
115
M````````````````````````````````````````````````````````````
116
M````````````````````````````````````````````````````````````
117
M````````````````````````````````````````````````````````````
118
M````````````````````````````````````````````````````````````
119
M````````````````````````````````````````````````````````````
120
M````````````````````````````````````````````````````````````
121
M````````````````````````````````````````````````````````````
122
M````````````````````````````````````````````````````````````
123
M````````````````````````````````````````````````````````````
124
M````````````````````````````````````````````````````````````
125
M````````````````````````````````````````````````````````````
126
M````````````````````````````````````````````````````````````
127
M````````````````````````````````````````````````````````````
128
M````````````````````````````````````````````````````````````
129
M````````````````````````````````````````````````````````````
130
M````````````````````````````````````````````````````````````
131
M````````````````````````````````````````````````````````````
132
M````````````````````````````````````````````````````````````
133
M````````````````````````````````````````````````````````````
134
M````````````````````````````````````````````````````````````
135
M````````````````````````````````````````````````````````````
136
M````````````````````````````````````````````````````````````
137
M````````````````````````````````````````````````````````````
138
M````````````````````````````````````````````````````````````
139
M````````````````````````````````````````````````````````````
140
M````````````````````````````````````````````````````````````
141
M````````````````````````````````````````````````````````````
142
M````````````````````````````````````````````````````````````
143
M````````````````````````````````````````````````````````````
144
M````````````````````````````````````````````````````````````
145
M````````````````````````````````````````````````````````````
146
M````````````````````````````````````````````````````````````
147
M````````````````````````````````````````````````````````````
148
M````````````````````````````````````````````````````````````
149
M````````````````````````````````````````````````````````````
150
M````````````````````````````````````````````````````````````
151
M````````````````````````````````````````````````````````````
152
M````````````````````````````````````````````````````````````
153
M````````````````````````````````````````````````````````````
154
M````````````````````````````````````````````````````````````
155
M````````````````````````````````````````````````````````````
156
M````````````````````````````````````````````````````````````
157
M````````````````````````````````````````````````````````````
158
M````````````````````````````````````````````````````````````
159
M````````````````````````````````````````````````````````````
160
M````````````````````````````````````````````````````````````
161
M````````````````````````````````````````````````````````````
162
M````````````````````````````````````````````````````````````
163
M````````````````````````````````````````````````````````````
164
M````````````````````````````````````````````````````````````
165
M````````````````````````````````````````````````````````````
166
M````````````````````````````````````````````````````````````
167
M````````````````````````````````````````````````````````````
168
M````````````````````````````````````````````````````````````
169
M````````````````````````````````````````````````````````````
170
M````````````````````````````````````````````````````````````
171
M````````````````````````````````````````````````````````````
172
M````````````````````````````````````````````````````````````
173
M````````````````````````````````````````````````````````````
174
M````````````````````````````````````````````````````````````
175
M````````````````````````````````````````````````````````````
176
M````````````````````````````````````````````````````````````
177
M````````````````````````````````````````````````````````````
178
M````````````````````````````````````````````````````````````
179
M````````````````````````````````````````````````````````````
180
M````````````````````````````````````````````````````````````
181
M````````````````````````````````````````````````````````````
182
M````````````````````````````````````````````````````````````
183
M````````````````````````````````````````````````````````````
184
M````````````````````````````````````````````````````````````
185
M````````````````````````````````````````````````````````````
186
M````````````````````````````````````````````````````````````
187
M````````````````````````````````````````````````````````````
188
M````````````````````````````````````````````````````````````
189
M````````````````````````````````````````````````````````````
190
M````````````````````````````````````````````````````````````
191
M````````````````````````````````````````````````````````````
192
M````````````````````````````````````````````````````````````
193
M````````````````````````````````````````````````````````````
194
M````````````````````````````````````````````````````````````
195
M````````````````````````````````````````````````````````````
196
M````````````````````````````````````````````````````````````
197
M````````````````````````````````````````````````````````````
198
M````````````````````````````````````````````````````````````
199
M````````````````````````````````````````````````````````````
200
M````````````````````````````````````````````````````````````
201
M````````````````````````````````````````````````````````````
202
M````````````````````````````````````````````````````````````
203
M````````````````````````````````````````````````````````````
204
M````````````````````````````````````````````````````````````
205
M````````````````````````````````````````````````````````````
206
M````````````````````````````````````````````````````````````
207
M````````````````````````````````````````````````````````````
208
M````````````````````````````````````````````````````````````
209
M````````````````````````````````````````````````````````````
210
M````````````````````````````````````````````````````````````
211
M````````````````````````````````````````````````````````````
212
M````````````````````````````````````````````````````````````
213
M````````````````````````````````````````````````````````````
214
M````````````````````````````````````````````````````````````
215
M````````````````````````````````````````````````````````````
216
M````````````````````````````````````````````````````````````
217
M````````````````````````````````````````````````````````````
218
M````````````````````````````````````````````````````````````
219
M````````````````````````````````````````````````````````````
220
M````````````````````````````````````````````````````````````
221
M````````````````````````````````````````````````````````````
222
M````````````````````````````````````````````````````````````
223
M````````````````````````````````````````````````````````````
224
M````````````````````````````````````````````````````````````
225
M````````````````````````````````````````````````````````````
226
M````````````````````````````````````````````````````````````
227
M````````````````````````````````````````````````````````````
228
M````````````````````````````````````````````````````````````
229
M````````````````````````````````````````````````````````````
230
M````````````````````````````````````````````````````````````
231
M````````````````````````````````````````````````````````````
232
M````````````````````````````````````````````````````````````
233
M````````````````````````````````````````````````````````````
234
M````````````````````````````````````````````````````````````
235
M````````````````````````````````````````````````````````````
236
M````````````````````````````````````````````````````````````
237
M````````````````````````````````````````````````````````````
238
M````````````````````````````````````````````````````````````
239
M````````````````````````````````````````````````````````````
240
M````````````````````````````````````````````````````````````
241
M````````````````````````````````````````````````````````````
242
"````
243
`
244
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_iso_3.iso.Z.uu (+40 lines)
Added Link Here
1
Same as test_read_format_iso_2.iso.Z except that the root directory record
2
size in the PVD has been changed to 68 bytes (instead of the 34 required
3
by the standard).  This non-standard value was seen in the wild.
4
5
begin 644 test_read_format_iso_3.iso.Z
6
M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR
7
MI,F3*%.J7,FRI<N7,&/*G$FSILV;.'/JW,FSI\^?0(,*'4JTJ-&C2),J7<JT
8
MJ=.G4*-*G4JUJM6K6+-JW<JUJ]>O8,.*'4NVK-FS:-.J7<NVK=NW<./*G4NW
9
MKMV[>//JW<NWK]^_@`,+'DRXL.'#B!,K7LRXL>/'D"-+GDRYLN7+F#-KWLRY
10
ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\
11
MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^
12
MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$Z408<04Q`!PH,01BCA
13
MA!16:.&%$!Z404$;>G0@``%\>"`""`#@04$>2)#0!`,1`0`%!<%8HD`EEF+C
14
MC:4($)"(!V+HXX]`!BGDD$06:>212":IY)),-NGDDU!&*>645%9II8\R%!@#
15
M##C$0(,,,6Q)PPP$DI-EF%QZ"::89,)`#H%PQBDGG&=NV>67:(Y9YH?_]>GG
16
MGX7](R"!!@)JZ*&()JKHHL<="...`AU80:0`!`$B`!=0.@2CG';JZ:>@A@H8
17
MGR]>:FI`DP9@*:F9!BCJJ[#&*NNLM#XE0JD$R3A0C3C:J*.I(0)PZZ,#Z4HC
18
M`+WZ"BF((=XZ*4&3SAA0B6\@X$`%"AA`SJ\\!G%KI@1E*BT`U%J+[0+;+AOB
19
MIK6VZ^Z[\,8;G;,%1;LK`-5>FVVZP!XX;(SDWIMLCNJ&:`(`%A1D@0$%&9`O
20
MMMI2"B(!0KBP0PSR9JSQQAQWW!P:9;#!QAL*>&SRR2BGK'*GWQ8D[KT/*X`N
21
MMSOZBVNQ`1\[,,W,!G`P!@5AP#!!#ILK,SD2!T``$19CO/+34$<M]=2$@2PR
22
MR51GK?767'?M]==@ARWVV&27;?;9:*>M]MILM^WVVW#'+??<=-=M]]UXYZWW
23
MWGSW[???@`<N^."$%V[XX8@GKOCBC#?N^..01R[YY)17;OGEF&>N^>:<=^[Y
24
MYZ"'+OKHI)=N^NFHIZ[ZZJRW[OKKL,<N^^RTUV[[[;CGKOONO/?N^^_`!R_\
25
M\,07;_SQR">O_/+,-^_\\]!'+_WTU%=O_?789Z_]]MQW[_WWX(<O_OCDEV_^
26
M^>BGK_[Z[+?O_OOPQR___/37;__]^.>O__[\]^___P`,H``'2,`"&O"`"$R@
27
M`A?(P`8Z\($0C*`$)TC!"EKP@AC,H`8WR,$.>O"#(`RA"$=(PA*:\(0H3*$*
28
M5\C"%KKPA3",H0QG2,,:VO"&.,RA#G?(PQ[Z\(=`#*(0ATC$(AKQB$A,HA*7
29
MR,0F.O&)4(RB%*=(Q2I:\8I8S*(6M\C%+GKQBV`,HQC'2,8RFO&,:$RC&M?(
30
MQC:Z\8UPC*,<YTC'.MKQCGC,HQ[WR,<^^O&/@`RD(`=)R$(:\I"(3*0B%\G(
31
M1CKRD9",I"0G2<E*6O*2F,RD)C?)R4YZ\I.@#*4H1TG*4IKRE*A,I2I7R<I6
32
MNO*5L(RE+&=)RUK:\I:XS*4N=\G+7OKRE\`,IC"'2<QB&O.8R$RF,I?)S&8Z
33
M\YG0C*8TITG-:EKSFMC,IC:WR<UN>O.;X`RG.,=)SG*:\YSH3*<ZU\G.=KKS
34
MG?",ISSG2<]ZVO.>^,RG/O?)SW[Z\Y\`#:A`!TK0@AKTH`A-J$(7RM"&.O2A
35
M$(VH1"=*T8I:]*(8S:A&-\K1CGKTHR`-J4A'2M*2FO2D*$VI2E?*TI:Z]*4P
36
MC:E,9TK3FMKTICC-J4YWRM.>^O2G0`VJ4(=*U*(:]:A(3:I2E\K4ICKUJ5"-
37
MJE2G2M6J6O6J6,VJ5K?*U:YZ]:M@#:M8QTK6LIKUK&A-JUK7RM:VNO6M<(VK
38
".`$`
39
`
40
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_iso_Z.c (-3 / +119 lines)
Lines 40-47 test1(void) Link Here
40
	    archive_read_support_format_all(a));
40
	    archive_read_support_format_all(a));
41
	assertEqualIntA(a, ARCHIVE_OK,
41
	assertEqualIntA(a, ARCHIVE_OK,
42
	    archive_read_open_filename(a, name, 512));
42
	    archive_read_open_filename(a, name, 512));
43
44
	/* Root directory */
43
	assertEqualIntA(a, ARCHIVE_OK,
45
	assertEqualIntA(a, ARCHIVE_OK,
44
	    archive_read_next_header(a, &ae));
46
	    archive_read_next_header(a, &ae));
47
	assertEqualIntA(a, 1131434684, archive_entry_atime(ae));
48
	assertEqualIntA(a, 0, archive_entry_birthtime(ae));
49
	assertEqualIntA(a, 1131434684, archive_entry_ctime(ae));
50
	assertEqualIntA(a, 0, archive_entry_dev(ae));
51
	assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
52
	assertEqualIntA(a, 0, archive_entry_gid(ae));
53
	assertEqualStringA(a, NULL, archive_entry_gname(ae));
54
	assertEqualIntA(a, 0, archive_entry_ino(ae));
55
	assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
56
	assertEqualIntA(a, 1131434684, archive_entry_mtime(ae));
57
	assertEqualIntA(a, 2, archive_entry_nlink(ae));
58
	assertEqualStringA(a, ".", archive_entry_pathname(ae));
59
	assertEqualIntA(a, 0700, archive_entry_perm(ae));
60
	assertEqualIntA(a, 2048, archive_entry_size(ae));
61
	assertEqualIntA(a, 0, archive_entry_uid(ae));
62
	assertEqualStringA(a, NULL, archive_entry_uname(ae));
63
64
	assertEqualIntA(a, ARCHIVE_EOF,
65
	    archive_read_next_header(a, &ae));
45
	assertEqualInt(1, archive_file_count(a));
66
	assertEqualInt(1, archive_file_count(a));
46
	assertEqualInt(archive_filter_code(a, 0),
67
	assertEqualInt(archive_filter_code(a, 0),
47
	    ARCHIVE_FILTER_COMPRESS);
68
	    ARCHIVE_FILTER_COMPRESS);
Lines 53-63 test1(void) Link Here
53
}
74
}
54
75
55
static void
76
static void
56
test2(void)
77
test_small(const char *name)
57
{
78
{
58
	struct archive_entry *ae;
79
	struct archive_entry *ae;
59
	struct archive *a;
80
	struct archive *a;
60
	const char *name = "test_read_format_iso_2.iso.Z";
61
81
62
	extract_reference_file(name);
82
	extract_reference_file(name);
63
83
Lines 68-88 test2(void) Link Here
68
	    archive_read_support_format_all(a));
88
	    archive_read_support_format_all(a));
69
	assertEqualIntA(a, ARCHIVE_OK,
89
	assertEqualIntA(a, ARCHIVE_OK,
70
	    archive_read_open_filename(a, name, 512));
90
	    archive_read_open_filename(a, name, 512));
91
92
	/* Root directory */
71
	assertEqualIntA(a, ARCHIVE_OK,
93
	assertEqualIntA(a, ARCHIVE_OK,
72
	    archive_read_next_header(a, &ae));
94
	    archive_read_next_header(a, &ae));
73
	assertEqualString(".", archive_entry_pathname(ae));
95
	assertEqualString(".", archive_entry_pathname(ae));
96
	assertEqualInt(0, archive_entry_atime_is_set(ae));
97
	assertEqualInt(0, archive_entry_atime(ae));
98
	assertEqualInt(0, archive_entry_birthtime_is_set(ae));
99
	assertEqualInt(0, archive_entry_birthtime(ae));
100
	assertEqualInt(0, archive_entry_ctime_is_set(ae));
101
	assertEqualInt(0, archive_entry_ctime(ae));
102
	assertEqualIntA(a, 0, archive_entry_dev(ae));
103
	assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
104
	assertEqualIntA(a, 0, archive_entry_gid(ae));
105
	assertEqualStringA(a, NULL, archive_entry_gname(ae));
106
	assertEqualIntA(a, 0, archive_entry_ino(ae));
107
	assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
108
	assertEqualInt(0, archive_entry_mtime_is_set(ae));
109
	assertEqualInt(0, archive_entry_mtime(ae));
110
	assertEqualIntA(a, 4, archive_entry_nlink(ae));
111
	assertEqualIntA(a, 0700, archive_entry_perm(ae));
112
	assertEqualIntA(a, 2048, archive_entry_size(ae));
113
	assertEqualIntA(a, 0, archive_entry_uid(ae));
114
	assertEqualStringA(a, NULL, archive_entry_uname(ae));
115
116
	/* Directory "A" */
74
	assertEqualIntA(a, ARCHIVE_OK,
117
	assertEqualIntA(a, ARCHIVE_OK,
75
	    archive_read_next_header(a, &ae));
118
	    archive_read_next_header(a, &ae));
76
	assertEqualString("A", archive_entry_pathname(ae));
119
	assertEqualString("A", archive_entry_pathname(ae));
120
	assertEqualIntA(a, 1313381406, archive_entry_atime(ae));
121
	assertEqualIntA(a, 0, archive_entry_birthtime(ae));
122
	assertEqualIntA(a, 1313381406, archive_entry_ctime(ae));
123
	assertEqualIntA(a, 0, archive_entry_dev(ae));
124
	assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
125
	assertEqualIntA(a, 0, archive_entry_gid(ae));
126
	assertEqualStringA(a, NULL, archive_entry_gname(ae));
127
	assertEqualIntA(a, 0, archive_entry_ino(ae));
128
	assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
129
	assertEqualIntA(a, 1313381406, archive_entry_mtime(ae));
130
	assertEqualIntA(a, 2, archive_entry_nlink(ae));
131
	assertEqualIntA(a, 0700, archive_entry_perm(ae));
132
	assertEqualIntA(a, 2048, archive_entry_size(ae));
133
	assertEqualIntA(a, 0, archive_entry_uid(ae));
134
	assertEqualStringA(a, NULL, archive_entry_uname(ae));
135
136
	/* File "A/B" */
77
	assertEqualIntA(a, ARCHIVE_OK,
137
	assertEqualIntA(a, ARCHIVE_OK,
78
	    archive_read_next_header(a, &ae));
138
	    archive_read_next_header(a, &ae));
79
	assertEqualString("A/B", archive_entry_pathname(ae));
139
	assertEqualString("A/B", archive_entry_pathname(ae));
140
	assertEqualIntA(a, 1313381406, archive_entry_atime(ae));
141
	assertEqualIntA(a, 0, archive_entry_birthtime(ae));
142
	assertEqualIntA(a, 1313381406, archive_entry_ctime(ae));
143
	assertEqualIntA(a, 0, archive_entry_dev(ae));
144
	assertEqualIntA(a, AE_IFREG, archive_entry_filetype(ae));
145
	assertEqualIntA(a, 0, archive_entry_gid(ae));
146
	assertEqualStringA(a, NULL, archive_entry_gname(ae));
147
	assertEqualIntA(a, 0, archive_entry_ino(ae));
148
	assertEqualIntA(a, AE_IFREG | 0400, archive_entry_mode(ae));
149
	assertEqualIntA(a, 1313381406, archive_entry_mtime(ae));
150
	assertEqualIntA(a, 1, archive_entry_nlink(ae));
151
	assertEqualIntA(a, 0400, archive_entry_perm(ae));
152
	assertEqualIntA(a, 6, archive_entry_size(ae));
153
	assertEqualIntA(a, 0, archive_entry_uid(ae));
154
	assertEqualStringA(a, NULL, archive_entry_uname(ae));
155
	/* TODO: Verify that file contents are "hello\n" */
156
157
	/* Directory "C" */
80
	assertEqualIntA(a, ARCHIVE_OK,
158
	assertEqualIntA(a, ARCHIVE_OK,
81
	    archive_read_next_header(a, &ae));
159
	    archive_read_next_header(a, &ae));
82
	assertEqualString("C", archive_entry_pathname(ae));
160
	assertEqualString("C", archive_entry_pathname(ae));
161
	assertEqualIntA(a, 1313381411, archive_entry_atime(ae));
162
	assertEqualIntA(a, 0, archive_entry_birthtime(ae));
163
	assertEqualIntA(a, 1313381411, archive_entry_ctime(ae));
164
	assertEqualIntA(a, 0, archive_entry_dev(ae));
165
	assertEqualIntA(a, AE_IFDIR, archive_entry_filetype(ae));
166
	assertEqualIntA(a, 0, archive_entry_gid(ae));
167
	assertEqualStringA(a, NULL, archive_entry_gname(ae));
168
	assertEqualIntA(a, 0, archive_entry_ino(ae));
169
	assertEqualIntA(a, AE_IFDIR | 0700, archive_entry_mode(ae));
170
	assertEqualIntA(a, 1313381411, archive_entry_mtime(ae));
171
	assertEqualIntA(a, 2, archive_entry_nlink(ae));
172
	assertEqualIntA(a, 0700, archive_entry_perm(ae));
173
	assertEqualIntA(a, 2048, archive_entry_size(ae));
174
	assertEqualIntA(a, 0, archive_entry_uid(ae));
175
	assertEqualStringA(a, NULL, archive_entry_uname(ae));
176
177
	/* File "C/D" */
83
	assertEqualIntA(a, ARCHIVE_OK,
178
	assertEqualIntA(a, ARCHIVE_OK,
84
	    archive_read_next_header(a, &ae));
179
	    archive_read_next_header(a, &ae));
85
	assertEqualString("C/D", archive_entry_pathname(ae));
180
	assertEqualString("C/D", archive_entry_pathname(ae));
181
	assertEqualIntA(a, 1313381411, archive_entry_atime(ae));
182
	assertEqualIntA(a, 0, archive_entry_birthtime(ae));
183
	assertEqualIntA(a, 1313381411, archive_entry_ctime(ae));
184
	assertEqualIntA(a, 0, archive_entry_dev(ae));
185
	assertEqualIntA(a, AE_IFREG, archive_entry_filetype(ae));
186
	assertEqualIntA(a, 0, archive_entry_gid(ae));
187
	assertEqualStringA(a, NULL, archive_entry_gname(ae));
188
	assertEqualIntA(a, 0, archive_entry_ino(ae));
189
	assertEqualIntA(a, AE_IFREG | 0400, archive_entry_mode(ae));
190
	assertEqualIntA(a, 1313381411, archive_entry_mtime(ae));
191
	assertEqualIntA(a, 1, archive_entry_nlink(ae));
192
	assertEqualIntA(a, 0400, archive_entry_perm(ae));
193
	assertEqualIntA(a, 6, archive_entry_size(ae));
194
	assertEqualIntA(a, 0, archive_entry_uid(ae));
195
	assertEqualStringA(a, NULL, archive_entry_uname(ae));
196
	/* TODO: Verify that file contents are "hello\n" */
197
198
	/* Final statistics */
86
	assertEqualIntA(a, ARCHIVE_EOF,
199
	assertEqualIntA(a, ARCHIVE_EOF,
87
	    archive_read_next_header(a, &ae));
200
	    archive_read_next_header(a, &ae));
88
	assertEqualInt(5, archive_file_count(a));
201
	assertEqualInt(5, archive_file_count(a));
Lines 98-102 test2(void) Link Here
98
DEFINE_TEST(test_read_format_iso_Z)
211
DEFINE_TEST(test_read_format_iso_Z)
99
{
212
{
100
	test1();
213
	test1();
101
	test2();
214
	/* A very small ISO image with a variety of contents. */
215
	test_small("test_read_format_iso_2.iso.Z");
216
	/* As above, but with a non-standard 68-byte root directory in the PVD */
217
	test_small("test_read_format_iso_3.iso.Z");
102
}
218
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_mtree.c (-1 / +1 lines)
Lines 158-164 test_read_format_mtree1(void) Link Here
158
	/* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */
158
	/* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */
159
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
159
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
160
	assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile");
160
	assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile");
161
	assertEqualInt(archive_entry_size(ae), -1);
161
	assertEqualInt(archive_entry_size(ae), 0);
162
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
162
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
163
	assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
163
	assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
164
164
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar4_encrypted.rar.uu (+10 lines)
Added Link Here
1
begin 0744 test_read_format_rar4_encrypted.rar
2
M4F%R(1H'`,^0<P``#0`````````J8W0@D"H`$@```!(````"56Y:[F17=E@=
3
M,`4`(````&$N='AT`/#\3!M4:&ES(&ES(&9R;VT@82YT>'1?CG0DE#(`(```
4
M`!(````"A13ZJ6=7=E@=,P4`(````&(N='ATO@(;FGDJBE4`L'*@-,GY]@T0
5
M?ZC1UGSKU*2VR-1K@HH>GZZP#?C:ML=$"NKDN\=T()`J`!(````2`````C4]
6
MFI1N5W98'3`%`"````!C+G1X=`"P/D@M5&AI<R!I<R!F<F]M(&,N='AT[<IT
7
M))0R`"`````2`````B7ANB9-9'98'3,%`"````!D+G1X=*_B?1/SI5-2`/#[
8
I88]V^#_)1V@;4"TVC,!XR=.I1:KVB0/<OAC@C&97VP3UZ<0]>P!`!P``
9
`
10
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar4_encrypted_filenames.rar.uu (+14 lines)
Added Link Here
1
begin 0744 test_read_format_rar4_encrypted_filenames.rar
2
M4F%R(1H'`,Z9<X``#0```````````````````'0+AC,H,+6'0#)>8VT<XO:*
3
M5M'"E1[V+ZKT=VW!$Y2=W$,@Y24Z^"L_;GVG\*4]&"6BQ#?@6TX38EQ\8\4-
4
M<S5U7JMAF.'L3LOOCM6]\Q60C51S.)^'6MOG_R<DW8EG(```````````(B,(
5
M]O5[61NCM'\Q9[&<E5D6F6`?WI`#-.(]J?W^C9!U-5O^2='P+5K(ED[:I4T=
6
M0/ZHVQ[F8HPBZ<+WA.*T5<R$K+8&/OR_\BN8V5VVM]"5F:$4Y:\JR,),%],1
7
MR;Z>``````````#*B0$)1EIB[[O98],X0DT>H`N+&*.NNPK!]1XJ#(AF_TF6
8
M0FE3!L0.1T+=I<'X[Z0:F23U_[6S.I:ZNQ.\@HZ\]&0L/P:SA$:,Y<^4.A!\
9
MSBD7NK5[VE/9$9K/N2`[7]T``````````.\$Z3?>_Z.3*>6<12%741?6_./A
10
M!:XA!P"B0PS55>+%J)-H$0T!//>$']'-U?_"O=N?_:SNE<^54Z3/[8,M^F?6
11
M36)XOUNLS4@\\N@1J#Z/V?J<_XS>CNA21,<Q;<;C[@``````````\)]%=^L\
12
*)-I(DJO^>177HP``
13
`
14
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar4_solid_encrypted.rar.uu (+11 lines)
Added Link Here
1
begin 0744 test_read_format_rar4_solid_encrypted.dat
2
M4F%R(1H'`#O0<P@`#0`````````A873$E#(`,````!(````"56Y:[F17=E@=
3
M,P4`(````&$N='AT````````````\/Q,&]Q,RV`3V)H10_&#G@'FZ'@$+I%W
4
MXP?A#XMQ>A-D/\9QH!R+,]AV(8F*MQD3.<V`SC96=-24,@`0````$@````*%
5
M%/JI9U=V6!TS!0`@````8BYT>'2/%M7(05"L]0"P<J`TBK7M!JH)_:_8K\\K
6
M,U_X>\,C=-24,@`0````$@````(U/9J4;E=V6!TS!0`@````8RYT>'1ILB:<
7
M@2)@M@"P/D@MD'UA]R2N^_G@1!L-H?V>K-TV=-24,@`0````$@````(EX;HF
8
M361V6!TS!0`@````9"YT>'2C+AKDKML%S0#P^V&/?J,L#@>!52=M.=PPCAJF
9
(IL0]>P!`!P``
10
`
11
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar4_solid_encrypted_filenames.rar.uu (+13 lines)
Added Link Here
1
begin 0744 test_read_format_rar4_solid_encrypted_filenames.rar
2
M4F%R(1H'`#K9<X@`#0```````````````````,L":IWIGA+/YV2@]#O3Z\&O
3
MM'G1)=DT/G2[DW184@7Z`)NZR=<IA_-5+=&`P_B)U/,]<+8]C:YI<X@;OT`3
4
M]?.U#K0BV:I"0AYHE-->?V[74Q\@?])NR\68105J4BRL3O.E$I*!91X?$@/<
5
M5C[G2D$``````````!NS=YISD[7`_=#)$A.9/&9<3`&D$(L]$^-&%;!SH,%>
6
M!NZ:W\)5XCJI<"H7+BND(033Q/J9/18(=/`A%WI]@(`:H>AE`M3T)R8']S%P
7
MHYCV```````````&TB\_##3K6#@Q+J)RDEJ0$CI"]*R1)8!Q.3B[,7O5NM,]
8
ME::7;E__N2:-%4-;/D+DA:J@P.L0*I/__*OX77=\L4-&F^""&L'VP9/DK-;$
9
MLP``````````1D.3Y0+"D$@9F(IYV&*B<`A2J2$)(C=_X_QEMWE*VK9ITH*U
10
MAJ@<<Z%4#?(I"H:5J08&7^WM`<#3=A9D#':;X2IVK.%[ZZ#58(4W0Q[RT-X`
11
7`````````/"?17?K/"3:2)*K_GD5UZ,`
12
`
13
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar5.c (-6 / +33 lines)
Lines 843-849 DEFINE_TEST(test_read_format_rar5_block_by_block) Link Here
843
	struct archive_entry *ae;
843
	struct archive_entry *ae;
844
	struct archive *a;
844
	struct archive *a;
845
	uint8_t buf[173];
845
	uint8_t buf[173];
846
	int bytes_read;
846
	ssize_t bytes_read;
847
	uint32_t computed_crc = 0;
847
	uint32_t computed_crc = 0;
848
848
849
	extract_reference_file("test_read_format_rar5_compressed.rar");
849
	extract_reference_file("test_read_format_rar5_compressed.rar");
Lines 932-950 DEFINE_TEST(test_read_format_rar5_symlink) Link Here
932
	assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
932
	assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
933
	assertEqualString("file.txt", archive_entry_symlink(ae));
933
	assertEqualString("file.txt", archive_entry_symlink(ae));
934
	assertEqualInt(AE_SYMLINK_TYPE_FILE, archive_entry_symlink_type(ae));
934
	assertEqualInt(AE_SYMLINK_TYPE_FILE, archive_entry_symlink_type(ae));
935
	assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
935
	assertEqualInt(0, archive_entry_size(ae));
936
	assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
936
937
937
	assertA(0 == archive_read_next_header(a, &ae));
938
	assertA(0 == archive_read_next_header(a, &ae));
938
	assertEqualString("dirlink", archive_entry_pathname(ae));
939
	assertEqualString("dirlink", archive_entry_pathname(ae));
939
	assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
940
	assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
940
	assertEqualString("dir", archive_entry_symlink(ae));
941
	assertEqualString("dir", archive_entry_symlink(ae));
941
	assertEqualInt(AE_SYMLINK_TYPE_DIRECTORY, archive_entry_symlink_type(ae));
942
	assertEqualInt(AE_SYMLINK_TYPE_DIRECTORY, archive_entry_symlink_type(ae));
942
	assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
943
	assertEqualInt(0, archive_entry_size(ae));
944
	assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
943
945
944
	assertA(0 == archive_read_next_header(a, &ae));
946
	assertA(0 == archive_read_next_header(a, &ae));
945
	assertEqualString("dir", archive_entry_pathname(ae));
947
	assertEqualString("dir", archive_entry_pathname(ae));
946
	assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
948
	assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
947
	assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
949
	assertEqualInt(0, archive_entry_size(ae));
950
	assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
948
951
949
	assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
952
	assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
950
953
Lines 969-975 DEFINE_TEST(test_read_format_rar5_hardlink) Link Here
969
	assertEqualString("hardlink.txt", archive_entry_pathname(ae));
972
	assertEqualString("hardlink.txt", archive_entry_pathname(ae));
970
	assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
973
	assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
971
	assertEqualString("file.txt", archive_entry_hardlink(ae));
974
	assertEqualString("file.txt", archive_entry_hardlink(ae));
972
	assertA(0 == archive_read_data(a, NULL, archive_entry_size(ae)));
975
	assertEqualInt(0, archive_entry_size(ae));
976
	assertA(0 == archive_read_data(a, NULL, (size_t)archive_entry_size(ae)));
973
977
974
	assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
978
	assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
975
979
Lines 1340-1346 DEFINE_TEST(test_read_format_rar5_sfx) Link Here
1340
1344
1341
	assertA(size == archive_read_data(a, buff, size));
1345
	assertA(size == archive_read_data(a, buff, size));
1342
	assertEqualMem(buff, test_txt, size);
1346
	assertEqualMem(buff, test_txt, size);
1343
	
1347
1344
	EPILOGUE();
1348
	EPILOGUE();
1345
}
1349
}
1346
1350
Lines 1402-1404 DEFINE_TEST(test_read_format_rar5_read_data_block_uninitialized_offset) Link Here
1402
1406
1403
	EPILOGUE();
1407
	EPILOGUE();
1404
}
1408
}
1409
1410
DEFINE_TEST(test_read_format_rar5_data_ready_pointer_leak)
1411
{
1412
	/* oss fuzz 70024 */
1413
1414
	char buf[4096];
1415
	PROLOGUE("test_read_format_rar5_data_ready_pointer_leak.rar");
1416
1417
	/* Return codes of those calls are ignored, because this sample file
1418
	 * is invalid. However, the unpacker shouldn't produce any SIGSEGV
1419
	 * errors during processing. */
1420
1421
	(void) archive_read_next_header(a, &ae);
1422
	(void) archive_read_data(a, buf, sizeof(buf));
1423
	(void) archive_read_next_header(a, &ae);
1424
	(void) archive_read_data(a, buf, sizeof(buf));
1425
	(void) archive_read_data(a, buf, sizeof(buf));
1426
	(void) archive_read_next_header(a, &ae);
1427
	/* This call shouldn't produce SIGSEGV. */
1428
	(void) archive_read_data(a, buf, sizeof(buf));
1429
1430
	EPILOGUE();
1431
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar5_data_ready_pointer_leak.rar.uu (+28 lines)
Added Link Here
1
begin 644 test_read_format_rar5_data_ready_pointer_leak.rar.uu
2
M4F%R(1H'`0`]/-[E`@$`_R`@1#[Z5P("`P,`(/__(""`((``"2`@("`@_R`@
3
M("`@(%.`*O0#`N<B`A"`("#_((`+`00@("`@(""!)/\@("`@("`@(/\@("`@
4
M^I@R<00"WN<-\@$@_R`@(``C("`@("`@("`@("`@("`@("`@("`@("`@("#_
5
M____("`@(/___R#_("`@("`@("#___\@_____R`@("`@("`@(/__________
6
M____(/__(/\@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@________
7
M_________R`@____(/____\@("`@("`@("#______________R#___\@("`@
8
M("`@("`@("`@("`@("`@("`@(/\@("`@("`@("`@("`@("`@("`@("`@("`@
9
M("`@("`@("`@("`@("`@("`@("`@("`@_________R`@("`@_R`@("`@("`@
10
M("`@("`@(/__("`@("`@("`@("`@("`@(%.`*O0#`N<B`A"`_R`@_R#_"P$$
11
M("`@("`@@23_("`@_R`@("#_("`@(/J8,G$$`M[G#?(!(/\@("``(R`@("`@
12
M("`@("`@("`@("`@("`@("`@("#_("`@("`@("#_("`@("`@("`@("`@("`@
13
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("#_
14
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@____("`@("`@
15
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
16
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
17
M("`@("`@("`@("`@("`@("`@_R`@("`@("`@("`@("`@("`@("`@("`@("`@
18
M("!3@"KT`P+G(B`0@/\@(/\@_PL!_R"!)/\@("`@("`@(/\@("`@^I@R<00"
19
MWN<-\@$@_R`@(``C("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
20
M("`@("#______________R`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
21
M("`@("`@("`@("`@("`@("`@("`@(/\@(/_______R`@("`@("`@("`@("`@
22
M("`@("`@("`@_________R`@("`@("`@("`@("`@("`@(/________\@("`@
23
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@(/\@
24
M("`@("`@(/\@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
25
M("`@("`@("`@("`@("`@(/\@($0^^E<"`@,#("`@(/\@@``)("`@("`@("`@
26
)("`@("`@("`@
27
`
28
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar5_encrypted.rar.uu (+12 lines)
Added Link Here
1
begin 0744 test_read_format_rar5_encrypted.rar
2
M4F%R(1H'`0`SDK7E"@$%!@`%`0&`@``U_S(>'P(#"Q($$B!5;EKN@```!6$N
3
M='AT"@,"?"&$HX)\V@%4:&ES(&ES(&9R;VT@82YT>'1Z07&S4`(#/#`$$B`8
4
M1:,"@`,`!6(N='AT,`$``P_'1%[A@/BUG]8K0S<(O%?-^C3?!JM=!=23!W</
5
M'8Z`4^HU9QUP\2U+:YP:G`H#`G)EF*:"?-H!8[I4LM`0I4E?M+K3P&FH.QN\
6
MNS@GUX>3>',O?)/BTBC$`-[^IL`[?FQGU`50`-SXC7SQ9A\"`PL2!!(@-3V:
7
ME(````5C+G1X=`H#`CY(Z:Z"?-H!5&AI<R!I<R!F<F]M(&,N='AT[/WP75("
8
M`SR@``22`"##WV,2@`,`!60N='AT,`$``P_'1%[A@/BUG]8K0S<(O%?-\\W6
9
MLQRT6Z=\K#98CK,.:8-,U$CI%>O6K'>WHPH#`GO%*?2/?-H!VVER]/96CJ;]
10
?&67IE;,VA30W]2J@TR>'LO7!`C+8JEX==U91`P4$````
11
`
12
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar5_encrypted_filenames.rar.uu (+19 lines)
Added Link Here
1
begin 0744 test_read_format_rar5_encrypted_filenames.rar
2
M4F%R(1H'`0"N(]*0(00```$/:`NPT*?(O:'>=*=Q,C2;&;<*@A@[)[D`X\II
3
M)1#LA,>A'D8M?0XU3L36UDKMZ3EWQ[HCXZ3<%!O*=.Y,W/S<QCA?O/:*,^Z5
4
M=M6S3*Y6;+35C`9`*4W]<':72F3'&:K>,FBUJV)T^1MW,X0)C4P7W(`"$#-N
5
MQ\V%/Z&YJ=4A7#WA+9.5'__1CF)4F:?SV[[N1U^16P.+TQ5X.'"@NQ"=6K3Z
6
M>:;.1CVE<%%M1-OQ3L0FZ[KI2TSW`.2SF20<ZT/,=/(WK4+9"\+J&$')_3V,
7
MFW%?=^[MI.6[JA/>0V5WTB3-QIV<3Q'?++X$0]?XV(?ER,71CAXBNL1KT5A*
8
M8*&+T@6]A_)*KA]%V3S,0B;S(LW1V.AH.U6U0N\-%!@J9Q-FJ%^'O)(JR5+2
9
MS$5JO/XA3W4MSJ[R27%P_4$GAWSW!SS(4IA_-)Z:[:?V5D!F@TGG9L0!1TF[
10
M:AH<9G0.['%7-\:>"&(8Y#Z#62;U.:,3+=<$E6S8C02I[/<OZ>G>-3P1Y<'J
11
MW_FJ/]VJ-Q7IA64<?`;GTW<H]@=YS0)S*\?SKXQ$H.Y!<ZK`[1[?Z(\(_\]>
12
MU:_TK/EHMM;PWJ?3`Y9S6&%6L@T0-U<&4E[+_F>Z%+KFW'&W>`,.=]#SI;A[
13
MYA);NM6`5K01J]@IT6O8W#!].A$%_5M\E]S0&<D`"T,:H7>.TOPBCL9$C"GU
14
M2<W)Q\9ABJLH57<$#;&%<^N#-N[5KE?`56,WSHG<GU4!!.+@ZU+5N\;J[7J-
15
M**R#V\19<I;O[I%?-002U,8R$.^M/P8W]?26N+VB5-\B#7;SV;_L#%4PQ36P
16
MBTTF>G&8E))@.H01Q:@1Q^.YVYIG(?#2:S604D\'CWU.!:-E`=;4VFS+KULL
17
KJ<2G@G$-MF5V72TYY!]U(UB473O?`U'=W'#D\4A%S-_F?/@]S)MU>.[V1```
18
`
19
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar5_solid_encrypted.rar.uu (+14 lines)
Added Link Here
1
begin 0744 test_read_format_rar5_solid_encrypted.rar
2
M4F%R(1H'`0`@MOH1"@$%!@0%`0&`@`!A#\6>4@(#/+``!)(`(%5N6NZ`0P`%
3
M82YT>'0P`0`!#X`.^EM!19`,=C!0B-G+#?0([51UI],+OH^T\:=V\5`OX@\X
4
M+B?>=W@0'[TD"@,"?"&$HX)\V@$UI92M^>J?V-L?2@`2L023@_#?H\C>K?GG
5
MDT*27O`>\]$\(4^12SZAD2GI6I(?@NS\ETUG4@(#/)``!)(`(#W[M6/`0P`%
6
M8BYT>'0P`0`##X`.^EM!19`,=C!0B-G+#?09'G;UMT5!4+;8`6WM=*[?X@\X
7
M+B?>=W@0'[TD"@,"<F68IH)\V@$C,XZR45`RX*-59&X3Y'+)'7P<"E("`SR0
8
M``22`"#_)YR&P$,`!6,N='AT,`$``P^`#OI;0460#'8P4(C9RPWT6V3<1-F,
9
M1I0"0-:R/5=BUN(/."XGWG=X$!^])`H#`CY(Z:Z"?-H!BBA?J'.;?7%L12A&
10
M0%6=`D>/[#]2`@,\D``$D@`@>Q=TP\!#``5D+G1X=#`!``,/@`[Z6T%%D`QV
11
M,%"(V<L-]&ES:(+U/SMVI#;?U9:@A&OB#S@N)]YW>!`?O20*`P)[Q2GTCWS:
12
9`3G@<$3$LKSYCC7DX.K9`[`==U91`P4$````
13
`
14
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar5_solid_encrypted_filenames.rar.uu (+18 lines)
Added Link Here
1
begin 0744 test_read_format_rar5_solid_encrypted_filenames.rar
2
M4F%R(1H'`0";0=T:(00```$/AC5`PSS2$L"IUF$&I":C])K[3<7Y3A09X<`H
3
M`7''7U?%(MHPZ3W;#Z7PZEC<2`T4N9L0A@JE?=;1"4#J%N#6H+4KYITU<*=Q
4
MG$W?R7^W[#&LN^@M8(VSG.,@!1JFX359D^5#S[,ZW]V]CJ'J?-Z!KX^]Y1FB
5
M8I%5/(^2-8V^KY:K1^?K`DVW*MUL>Q9_6`W#,2ST:17"'W'YF2?)NH%5V"_F
6
M7;[0VI^.\JJ-T,_(\\5#ZX1HVQJ7KU0UCF#FGD-?NRMKA;X<,[/[*94^27X,
7
M#)I<:BO^_-I%B&A1U>S)9__""\/M>Q5AIY'*]EPTNJW+.J57[$X\U:;W">Z;
8
M8P\Z0[ZQOI*B*?BJ?B5+(/Z4.4AJ@;()1YUV4+XY#!76WZV]LZ+;GZ_Q#LLP
9
MP`7??+NV**I(A-9N^7HX\V!+YJ3%;R<PA5#T<.1"/TKRXC6SM=>%MD?Q5&H@
10
M>$VAME3"U$312+@SF+8F2RR0)T"DG^4N,^P46&+TZKQ7KS`4@-:J%_["UP"(
11
MK=]N^!UJUO2#6Q*`-`-)^?\/`;^4(@FVLVJ?!D,:O)A6@!TNA%.U^"0-?9H<
12
M:0&(UWV=+&[82L>'L4XYO20"@)^<WC4/BKMBFP0G&/3,!*[Y+,F),*X7V7]H
13
M3&`4SIL,>I']_<2C]D;_,]/)_1?N1+M@PTDL;'[J1L=5\,-?J5Q`$3>_9<2<
14
MS^)#MZ*AE=5@5[O(<]*(EIA62$U`5B18?#W;BB.*0A3O%<OI.7X`?QB-FRV]
15
M89*8RNH'P\"9I,0X&F;$<0Z70E(,^KF&PZ5WR-O%K;G`"/=E<\4-*H%FZ]O3
16
8G%A)/>[(IVC3ME2PY5F>9$/U'$VW1-BZ
17
`
18
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_rar_encryption.c (+176 lines)
Added Link Here
1
/*
2
 * Copyright (c) 2003-2018
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
#include "test.h"
27
28
/*
29
 * All of the archives for this teset contain four files: a.txt, b.txt, c.txt, and d.txt
30
 * For solid archives or archvies or archives where filenames are encrypted, all four files are encrypted with the
31
 * password "password". For non-solid archives without filename encryption, a.txt and c.txt are not encrypted, b.txt is
32
 * encrypted with the password "password", and d.txt is encrypted with the password "password2".
33
 *
34
 * For all files the file contents is "This is from <filename>" (i.e. "This is from a.txt" etc.)
35
 */
36
static void test_encrypted_rar_archive(const char *filename, int filenamesEncrypted, int solid)
37
{
38
	struct archive_entry *ae;
39
	struct archive *a;
40
	char buff[128];
41
	int expected_read_header_result, expected_read_data_result;
42
	const int expected_file_size = 18; /* This is from X.txt */
43
44
	/* We should only ever fail to read the header when filenames are encrypted. Otherwise we're failing for other
45
	 * unsupported reasons, in which case we have no hope of detecting encryption */
46
	expected_read_header_result = filenamesEncrypted ? ARCHIVE_FATAL : ARCHIVE_OK;
47
48
	/* We should only ever fail to read the data for "a.txt" and "c.txt" if they are encrypted */
49
	/* NOTE: We'll never attempt this when filenames are encrypted, so we only check for solid here */
50
	expected_read_data_result = solid ? ARCHIVE_FATAL : expected_file_size;
51
52
	extract_reference_file(filename);
53
	assert((a = archive_read_new()) != NULL);
54
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
55
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
56
	assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, filename, 10240));
57
58
	/* No data read yet; encryption unknown */
59
	assertEqualInt(ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a));
60
61
	/* Read the header for "a.txt" */
62
	assertEqualIntA(a, expected_read_header_result, archive_read_next_header(a, &ae));
63
	if (!filenamesEncrypted) {
64
		assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
65
		assertEqualString("a.txt", archive_entry_pathname(ae));
66
		assertEqualInt(expected_file_size, archive_entry_size(ae));
67
		assertEqualInt(solid, archive_entry_is_data_encrypted(ae));
68
		assertEqualInt(0, archive_entry_is_metadata_encrypted(ae));
69
		/* NOTE: The reader will set this value to zero on the first header that it reads, even if later entries
70
		 * are encrypted */
71
		assertEqualInt(solid, archive_read_has_encrypted_entries(a));
72
		assertEqualIntA(a, expected_read_data_result, archive_read_data(a, buff, sizeof(buff)));
73
		if (!solid) {
74
			assertEqualMem("This is from a.txt", buff, expected_file_size);
75
		}
76
	}
77
	else {
78
		assertEqualInt(1, archive_entry_is_data_encrypted(ae));
79
		assertEqualInt(1, archive_entry_is_metadata_encrypted(ae));
80
		assertEqualInt(1, archive_read_has_encrypted_entries(a));
81
		assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff)));
82
83
		/* Additional attempts to read headers are futile */
84
		assertEqualInt(ARCHIVE_OK, archive_read_close(a));
85
		assertEqualInt(ARCHIVE_OK, archive_read_free(a));
86
		return;
87
	}
88
89
	/* From here on out, we can assume that !filenamesEncrypted */
90
91
	/* Read the header for "b.txt" */
92
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
93
	assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
94
	assertEqualString("b.txt", archive_entry_pathname(ae));
95
	assertEqualInt(expected_file_size, archive_entry_size(ae));
96
	assertEqualInt(1, archive_entry_is_data_encrypted(ae));
97
	assertEqualInt(0, archive_entry_is_metadata_encrypted(ae));
98
	assertEqualInt(1, archive_read_has_encrypted_entries(a));
99
	assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff)));
100
101
	/* Read the header for "c.txt" */
102
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
103
	assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
104
	assertEqualString("c.txt", archive_entry_pathname(ae));
105
	assertEqualInt(expected_file_size, archive_entry_size(ae));
106
	assertEqualInt(solid, archive_entry_is_data_encrypted(ae));
107
	assertEqualInt(0, archive_entry_is_metadata_encrypted(ae));
108
	/* After setting to true above, this should forever be true */
109
	assertEqualInt(1, archive_read_has_encrypted_entries(a));
110
	assertEqualIntA(a, expected_read_data_result, archive_read_data(a, buff, sizeof(buff)));
111
	if (!solid) {
112
		assertEqualMem("This is from c.txt", buff, expected_file_size);
113
	}
114
115
	/* Read the header for "d.txt" */
116
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
117
	assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
118
	assertEqualString("d.txt", archive_entry_pathname(ae));
119
	assertEqualInt(expected_file_size, archive_entry_size(ae));
120
	assertEqualInt(1, archive_entry_is_data_encrypted(ae));
121
	assertEqualInt(0, archive_entry_is_metadata_encrypted(ae));
122
	assertEqualInt(1, archive_read_has_encrypted_entries(a));
123
	assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff)));
124
125
	/* End of archive. */
126
	assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
127
128
	/* Close the archive. */
129
	assertEqualInt(ARCHIVE_OK, archive_read_close(a));
130
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
131
}
132
133
DEFINE_TEST(test_read_format_rar4_encrypted)
134
{
135
	test_encrypted_rar_archive("test_read_format_rar4_encrypted.rar", 0, 0);
136
}
137
138
DEFINE_TEST(test_read_format_rar4_encrypted_filenames)
139
{
140
	test_encrypted_rar_archive("test_read_format_rar4_encrypted_filenames.rar", 1, 0);
141
}
142
143
DEFINE_TEST(test_read_format_rar4_solid_encrypted)
144
{
145
	/* TODO: If solid RAR4 support is ever added, the following should pass */
146
#if 0
147
	test_encrypted_rar_archive("test_read_format_rar4_solid_encrypted.rar", 0, 1);
148
#else
149
	skipping("RAR4 solid archive support not currently available");
150
#endif
151
}
152
153
DEFINE_TEST(test_read_format_rar4_solid_encrypted_filenames)
154
{
155
	test_encrypted_rar_archive("test_read_format_rar4_solid_encrypted_filenames.rar", 1, 1);
156
}
157
158
DEFINE_TEST(test_read_format_rar5_encrypted)
159
{
160
	test_encrypted_rar_archive("test_read_format_rar5_encrypted.rar", 0, 0);
161
}
162
163
DEFINE_TEST(test_read_format_rar5_encrypted_filenames)
164
{
165
	test_encrypted_rar_archive("test_read_format_rar5_encrypted_filenames.rar", 1, 0);
166
}
167
168
DEFINE_TEST(test_read_format_rar5_solid_encrypted)
169
{
170
	test_encrypted_rar_archive("test_read_format_rar5_solid_encrypted.rar", 0, 1);
171
}
172
173
DEFINE_TEST(test_read_format_rar5_solid_encrypted_filenames)
174
{
175
	test_encrypted_rar_archive("test_read_format_rar5_solid_encrypted_filenames.rar", 1, 1);
176
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_tar.c (-1 / +1 lines)
Lines 437-443 static void verify(unsigned char *d, size_t s, Link Here
437
	assertA(0 == archive_read_support_filter_all(a));
437
	assertA(0 == archive_read_support_filter_all(a));
438
	assertA(0 == archive_read_support_format_all(a));
438
	assertA(0 == archive_read_support_format_all(a));
439
	assertA(0 == archive_read_open_memory(a, buff, s + 1024));
439
	assertA(0 == archive_read_open_memory(a, buff, s + 1024));
440
	assertA(0 == archive_read_next_header(a, &ae));
440
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
441
	assertEqualInt(archive_filter_code(a, 0), compression);
441
	assertEqualInt(archive_filter_code(a, 0), compression);
442
	assertEqualInt(archive_format(a), format);
442
	assertEqualInt(archive_format(a), format);
443
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
443
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
(-)b/contrib/libarchive/libarchive/test/test_read_format_tar_pax_large_attr.c (+65 lines)
Added Link Here
1
/*-
2
 * Copyright (c) 2003-2023 Tim Kientzle
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
#include "test.h"
26
27
/*
28
 * Read a pax formatted tar archive that has an extremely large
29
 * (8,000,000 bytes) attribute of unknown type.  The pax reader should simply
30
 * skip the attribute.
31
 */
32
DEFINE_TEST(test_read_format_tar_pax_large_attr)
33
{
34
	char name[] = "test_read_format_tar_pax_large_attr.tar.Z";
35
	struct archive_entry *ae;
36
	struct archive *a;
37
38
	assert((a = archive_read_new()) != NULL);
39
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
40
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
41
	extract_reference_file(name);
42
	assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
43
44
	/* Read first entry. */
45
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
46
	assertEqualString("foo", archive_entry_pathname(ae));
47
	assertEqualInt(1, archive_entry_mtime(ae));
48
	assertEqualInt(1000, archive_entry_uid(ae));
49
	assertEqualString("tim", archive_entry_uname(ae));
50
	assertEqualInt(0, archive_entry_gid(ae));
51
	assertEqualString("wheel", archive_entry_gname(ae));
52
	assertEqualInt(0100644, archive_entry_mode(ae));
53
	assertEqualInt(archive_entry_is_encrypted(ae), 0);
54
	assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED);
55
56
	/* Verify the end-of-archive. */
57
	assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
58
59
	/* Verify that the format detection worked. */
60
	assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS);
61
	assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE);
62
63
	assertEqualInt(ARCHIVE_OK, archive_read_close(a));
64
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
65
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_tar_pax_large_attr.tar.Z.uu (+149 lines)
Added Link Here
1
Decode this file with:
2
cat test_read_format_tar_pax_large_attr.tar.Z.uu | uudecode -p | uncompress | hexdump -C
3
4
It contains a single tar entry with a pax header that has a single
5
attribute of 8000000 bytes
6
00000200  38 30 30 30 30 30 30 20  75 6e 6b 6e 6f 77 6e 3d  |8000000 unknown=|
7
00000210  2b 2b 2b 2b 2b 2b 2b 2b  2b 2b 2b 2b 2b 2b 2b 2b  |++++++++++++++++|
8
*
9
007a13f0  2b 2b 2b 2b 2b 2b 2b 2b  2b 2b 2b 2b 2b 2b 2b 0a  |+++++++++++++++.|
10
11
begin 644 test_read_format_tar_pax_large_attr.tar.Z
12
M'YV04,+@05(F#)DR<EZ8>?,&@,.'$"-*G$BQHL6+&"O"V&B#!@T0`#;"N&&C
13
M!DB1,&1\#+EQ1L<8,42"B$&CA@P;-UQZM`$"1HP9-6+<```"3\:C2),J73JQ
14
MSAPZ8>2PI).F#5.+3\.8,7-U(LJ-)[^"[$JVK-FS:-'B^`H#1!TW:]R\N>.F
15
MQXJ[>//JW<NWK]^_@`,+'DRXL.'#B!,K7LRXL>/'D"-+GDRYLN7+F#-KWLRY
16
ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\
17
MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^
18
MO?OW\./+GT^_OOW[^//KW\^_O___``8HX(`$%FC@@0@FJ.""##;HX(,01BCA
19
MA!16:.&%&&:HX88<=NCAAR"&*.*())9HXHDHIJCBBBRVZ.*+,,8HXXPTUFCC
20
MC3CFJ...//;HXX]`!BGDD$06:>212":IY)),-NGDDU!&*>645%9IY9589JGE
21
MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG
22
MGX`&*NB@A!9JZ*&()JKHHHPVZNBCD$8JZ:245FKII9AFJNFFG';JZ:>@ABKJ
23
MJ*26:NJIJ*:JZJJLMNKJJ[#&*NNLM-9JZZVXYJKKKKSVZNNOP`8K[+#$%FOL
24
ML<@FJ^RRS#;K[+/01BOMM-16:^VUV&:K[;;<=NOMM^"&*^ZXY)9K[KGHIJON
25
MNNRVZ^Z[\,8K[[STUFOOO?CFJ^^^_/;K[[\`!RSPP`07;/#!"">L\,(,-^SP
26
MPQ!'+/'$%%=L\<489ZSQQAQW[/''((<L\L@DEVSRR2BGK/+*++?L\LLPQRSS
27
MS#37;//-..>L\\X\]^SSST`'+?301!=M]-%()ZWTTDPW[?334$<M]=145VWU
28
MU5AGK?767'?M]==@ARWVV&27;?;9:*>M]MILM^WVVW#'+??<=-=M]]UXYZWW
29
MWGSW[???@`<N^."$%V[XX8@GKOCBC#?N^..01R[YY)17;OGEF&>N^>:<=^[Y
30
MYZ"'+OKHI)=N^NFHIZ[ZZJRW[OKKL,<N^^RTUV[[[;CGKOONO/?N^^_`!R_\
31
M\,07;_SQR">O_/+,-^_\\]!'+_WTU%=O_?789Z_]]MQW[_WWX(<O_OCDEV_^
32
M^>BGK_[Z[+?O_OOPQR___/37;__]^.>O__[\]^___P`,H``'2,`"&O"`"$R@
33
M`A?(P`8Z\($0C*`$)TC!"EKP@AC,H`8WR,$.>O"#(`RA"$=(PA*:\(0H3*$*
34
M5\C"%KKPA3",H0QG2,,:VO"&.,RA#G?(PQ[Z\(=`#*(0ATC$(AKQB$A,HA*7
35
MR,0F.O&)4(RB%*=(Q2I:\8I8S*(6M\C%+GKQBV`,HQC'2,8RFO&,:$RC&M?(
36
MQC:Z\8UPC*,<YTC'.MKQCGC,HQ[WR,<^^O&/@`RD(`=)R$(:\I"(3*0B%\G(
37
M1CKRD9",I"0G2<E*6O*2F,RD)C?)R4YZ\I.@#*4H1TG*4IKRE*A,I2I7R<I6
38
MNO*5L(RE+&=)RUK:\I:XS*4N=\G+7OKRE\`,IC"'2<QB&O.8R$RF,I?)S&8Z
39
M\YG0C*8TITG-:EKSFMC,IC:WR<UN>O.;X`RG.,=)SG*:\YSH3*<ZU\G.=KKS
40
MG?",ISSG2<]ZVO.>^,RG/O?)SW[Z\Y\`#:A`!TK0@AKTH`A-J$(7RM"&.O2A
41
M$(VH1"=*T8I:]*(8S:A&-\K1CGKTHR`-J4A'2M*2FO2D*$VI2E?*TI:Z]*4P
42
MC:E,9TK3FMKTICC-J4YWRM.>^O2G0`VJ4(=*U*(:]:A(3:I2E\K4ICKUJ5"-
43
MJE2G2M6J6O6J6,VJ5K?*U:YZ]:M@#:M8QTK6LIKUK&A-JUK7RM:VNO6M<(VK
44
M7.=*U[K:]:YXS:M>]\K7OOKUKX`-K&`'2]C"&O:PB$VL8A?+V,8Z]K&0C:QD
45
M)TO9REKVLIC-K&8WR]G.>O:SH`VM:$=+VM*:]K2H3:UJ5\O:UKKVM;"-K6QG
46
M2]O:VO:VN,VM;G?+V][Z]K?`#:YPATO<XAKWN,A-KG*7R]SF.O>YT(VN=*=+
47
MW>I:][K8S:YVM\O=[GKWN^`-KWC'2][RFO>\Z$VO>M?+WO:Z][WPC:]\YTO?
48
M^MKWOOC-KW[WR]_^^O>_``ZP@`=,X`(;^,`(3K""%\S@!COXP1".L(0G3.$*
49
M6_C"&,ZPAC?,X0Y[^,,@#K&(1TSB$IOXQ"A.L8I7S.(6N_C%,(ZQC&=,XQK;
50
M^,8XSK&.=\SC'OOXQT`.LI"'3.0B&_G(2$ZRDI?,Y"8[^<E0CK*4ITSE*EOY
51
MREC.LI:WS.4N>_G+8`ZSF,=,YC*;^<QH3K.:U\SF-KOYS7".LYSG3.<ZV_G.
52
M>,ZSGO?,YS[[^<^`#K2@!TWH0AOZT(A.M*(7S>A&._K1D(ZTI"=-Z4I;^M*8
53
MSK2F-\WI3GOZTZ`.M:A'3>I2F_K4J$ZUJE?-ZE:[^M6PCK6L9TWK6MOZUKC.
54
MM:YWS>M>^_K7P`ZVL(=-[&(;^]C(3K:RE\WL9CO[V=".MK2G3>UJ6_O:V,ZV
55
MMK?-[6Y[^]O@#K>XQTWN<IO[W.A.M[K7S>YVN_O=\(ZWO.=-[WK;^][XSK>^
56
M]\WO?OO[WP`/N,`'3O""&_S@"$^XPA?.\(8[_.$0C[C$)T[QBEO\XAC/N,8W
57
MSO&.>_SC(`^YR$=.\I*;_.0H3[G*5\[REKO\Y3"/N<QG3O.:V_SF.,^YSG?.
58
M\Y[[_.=`#[K0AT[THAO]Z$A/NM*7SO2F._WI4(^ZU*=.]:I;_>I8S[K6M\[U
59
MKGO]ZV`/N]C'3O:RF_WL:$^[VM?.]K:[_>UPC[O<YT[WNMO][GC/N][WSO>^
60
M^_WO@`^\X`=/^,(;_O"(3[SB%\_XQCO^\9"/O.0G3_G*6_[RF,^\YC?/^<Y[
61
M_O.@#[WH1T_ZTIO^]*A/O>I7S_K6N_[UL(^][&=/^]K;_O:XS[WN=\_[WOO^
62
M]\`/OO"'3_SB&__XR$^^\I?/_.8[__G0C[[TIT_]ZEO_^MC/OO:WS_WN>__[
63
MX`^_^,=/_O*;__SH3[_ZU\_^]KO__?"/O_SG3__ZV__^^,^__O?/__[[__\`
64
M&(`".(`$6(`&>(`(F(`*N(`,V(`.^(`0&($2.($46($6>($8F($:N($<V($>
65
M^($@&((B.((D6((F>((HF((JN((LV((N^((P&(,R.(,T6(,V>(,XF(,ZN(,\
66
MV(,^^(-`&(1".(1$6(1&>(1(F(1*N(1,V(1.^(10&(52.(546(56>(58F(5:
67
MN(5<V(5>^(5@&(9B.(9D6(9F>(9HF(9JN(9LV(9N^(9P&(=R.(=T6(=V>(=X
68
MF(=ZN(=\V(=^^(>`&(B".(B$6(B&>(B(F(B*N(B,V(B.^(B0&(F2.(F46(F6
69
M>(F8F(F:N(F<V(F>^(F@&(JB.(JD6(JF>(JHF(JJN(JLV(JN^(JP&(NR.(NT
70
M6(NV>(NXF(NZN(N\V(N^^(O`&(S".(S$6(S&>(S(F(S*N(S,V(S.^(S0&(W2
71
M.(W46(W6>(W8F(W:N(W<V(W>^(W@&([B.([D6([F>([HF([JN([LV([N^([P
72
M&(_R.(_T6(_V>(_XF(_ZN(_\V(_^^(\`&9`".9`$69`&>9`(F9`*N9`,V9`.
73
M^9`0&9$2.9$469$6>9$8F9$:N9$<V9$>^9$@&9(B.9(D69(F>9(HF9(JN9(L
74
MV9(N^9(P&9,R.9,T69,V>9,XF9,ZN9,\V9,^^9-`&91".91$691&>91(F91*
75
MN91,V91.^910&952.9546956>958F95:N95<V95>^95@&99B.99D699F>99H
76
MF99JN99LV99N^99P&9=R.9=T69=V>9=XF9=ZN9=\V9=^^9>`&9B".9B$69B&
77
M>9B(F9B*N9B,V9B.^9B0&9F2.9F469F6>9F8F9F:N9F<V9F>^9F@&9JB.9JD
78
M69JF>9JHF9JJN9JLV9JN^9JP&9NR.9NT69NV>9NXF9NZN9N\V9N^^9O`&9S"
79
M.9S$69S&>9S(F9S*N9S,V9S.^9S0&9W2.9W469W6>9W8F9W:N9W<V9W>^9W@
80
M&9[B.9[D69[F>9[HF9[JN9[LV9[N^9[P&9_R.9_T69_V>9_XF9_ZN9_\V9_^
81
M^9\`&J`".J`$6J`&>J`(FJ`*NJ`,VJ`.^J`0&J$2.J$46J$6>J$8FJ$:NJ$<
82
MVJ$>^J$@&J(B.J(D6J(F>J(HFJ(JNJ(LVJ(N^J(P&J,R.J,T6J,V>J,XFJ,Z
83
MNJ,\VJ,^^J-`&J1".J1$6J1&>J1(FJ1*NJ1,VJ1.^J10&J52.J546J56>J58
84
MFJ5:NJ5<VJ5>^J5@&J9B.J9D6J9F>J9HFJ9JNJ9LVJ9N^J9P&J=R.J=T6J=V
85
M>J=XFJ=ZNJ=\VJ=^^J>`&JB".JB$6JB&>JB(FJB*NJB,VJB.^JB0&JF2.JF4
86
M6JF6>JF8FJF:NJF<VJF>^JF@&JJB.JJD6JJF>JJHFJJJNJJLVJJN^JJP&JNR
87
M.JNT6JNV>JNXFJNZNJN\VJN^^JO`&JS".JS$6JS&>JS(FJS*NJS,VJS.^JS0
88
M&JW2.JW46JW6>JW8FJW:NJW<VJW>^JW@&J[B.J[D6J[F>J[HFJ[JNJ[LVJ[N
89
M^J[P&J_R.J_T6J_V>J_XFJ_ZNJ_\VJ_^^J\`&[`".[`$6[`&>[`(F[`*N[`,
90
MV[`.^[`0&[$2.[$46[$6>[$8F[$:N[$<V[$>^[$@&[(B.[(D6[(F>[(HF[(J
91
MN[(LV[(N^[(P&[,R.[,T6[,V>[,XF[,ZN[,\V[,^^[-`&[1".[1$6[1&>[1(
92
MF[1*N[1,V[1.^[10&[52.[546[56>[58F[5:N[5<V[5>^[5@&[9B.[9D6[9F
93
M>[9HF[9JN[9LV[9N^[9P&[=R.[=T6[=V>[=XF[=ZN[=\V[=^^[>`&[B".[B$
94
M6[B&>[B(F[B*N[B,V[B.^[B0&[F2.[F46[F6>[F8F[F:N[F<V[F>^[F@&[JB
95
M.[JD6[JF>[JHF[JJN[JLV[JN^[JP&[NR.[NT6[NV>[NXF[NZN[N\V[N^^[O`
96
M&[S".[S$6[S&>[S(F[S*N[S,V[S.^[S0&[W2.[W46[W6>[W8F[W:N[W<V[W>
97
M^[W@&[[B.[[D6[[F>[[HF[[JN[[LV[[N^[[P&[_R.[_T6[_V>[_XF[_ZN[_\
98
MV[_^^[\`',`"/,`$7,`&?,`(G,`*O,`,W,`._,`0',$2/,$47,$6?,$8G,$:
99
MO,$<W,$>_,$@',(B/,(D7,(F?,(HG,(JO,(LW,(N_,(P',,R/,,T7,,V?,,X
100
MG,,ZO,,\W,,^_,-`',1"/,1$7,1&?,1(G,1*O,1,W,1._,10',52/,547,56
101
M?,58G,5:O,5<W,5>_,5@',9B/,9D7,9F?,9HG,9JO,9LW,9N_,9P',=R/,=T
102
M7,=V?,=XG,=ZO,=\W,=^_,>`',B"/,B$7,B&?,B(G,B*O,B,W,B._,B0',F2
103
M/,F47,F6?,F8G,F:O,F<W,F>_,F@',JB/,JD7,JF?,JHG,JJO,JLW,JN_,JP
104
M',NR/,NT7,NV?,NXG,NZO,N\W,N^_,O`',S"/,S$7,S&?,S(G,S*O,S,W,S.
105
M_,S0',W2/,W47,W6?,W8G,W:O,W<W,W>_,W@',[B/,[D7,[F?,[HG,[JO,[L
106
MW,[N_,[P',_R/,_T7,_V?,_XG,_ZO,_\W,_^_,\`'=`"/=`$7=`&?=`(G=`*
107
MO=`,W=`._=`0'=$2/=$47=$6?=$8G=$:O=$<W=$>_=$@'=(B/=(D7=(F?=(H
108
MG=(JO=(LW=(N_=(P'=,R/=,T7=,V?=,XG=,ZO=,\W=,^_=-`'=1"/=1$7=1&
109
M?=1(G=1*O=1,W=1._=10'=52/=547=56?=58G=5:O=5<W=5>_=5@'=9B/=9D
110
M7=9F?=9HG=9JO=9LW=9N_=9P'==R/==T7==V?==XG==ZO==\W==^_=>`'=B"
111
M/=B$7=B&?=B(G=B*O=B,W=B._=B0'=F2/=F47=F6?=F8G=F:O=F<W=F>_=F@
112
M'=JB/=JD7=JF?=JHG=JJO=JLW=JN_=JP'=NR/=NT7=NV?=NXG=NZO=N\W=N^
113
M_=O`'=S"/=S$7=S&?=S(G=S*O=S,W=S._=S0'=W2/=W47=W6?=W8G=W:O=W<
114
MW=W>_=W@'=[B/=[D7=[F?=[HG=[JO=[LW=[N_=[P'=_R/=_T7=_V?=_XG=_Z
115
MO=_\W=_^_=\`'N`"/N`$7N`&?N`(GN`*ON`,WN`._N`0'N$2/N$47N$6?N$8
116
MGN$:ON$<WN$>_N$@'N(B/N(D7N(F?N(HGN(JON(LWN(N_N(P'N,R/N,T7N,V
117
M?N,XGN,ZON,\WN,^_N-`'N1"/N1$7N1&?N1(GN1*ON1,WN1._N10'N52/N54
118
M7N56?N58GN5:ON5<WN5>_N5@'N9B/N9D7N9F?N9HGN9JON9LWN9N_N9P'N=R
119
M/N=T7N=V?N=XGN=ZON=\WN=^_N>`'NB"/NB$7NB&?NB(GNB*ONB,WNB._NB0
120
M'NF2/NF47NF6?NF8GNF:ONF<WNF>_NF@'NJB/NJD7NJF?NJHGNJJONJLWNJN
121
M_NJP'NNR/NNT7NNV?NNXGNNZONN\WNN^_NO`'NS"/NS$7NS&?NS(GNS*ONS,
122
MWNS._NS0'NW2/NW47NW6?NW8GNW:ONW<WNW>_NW@'N[B/N[D7N[F?N[HGN[J
123
MON[LWN[N_N[P'N_R/N_T7N_V?N_XGN_ZON_\WN_^_N\`'_`"/_`$7_`&?_`(
124
MG_`*O_`,W_`.__`0'_$2/_$47_$6?_$8G_$:O_$<W_$>__$@'_(B/_(D7_(F
125
M?_(HG_(JO_(LW_(N__(P'_,R/_,T7_,V?_,XG_,ZO_,\W_,^__-`'_1"/_1$
126
M7_1&?_1(G_1*O_1,W_1.__10'_52/_547_56?_58G_5:O_5<W_5>__5@'_9B
127
M/_9D7_9F?_9HG_9JO_9LW_9N__9P'_=R/_=T7_=V?_=XG_=ZO_=\W_=^__>`
128
M'_B"/_B$7_B&?_B(G_B*O_B,W_B.__B0'_F2/_F47_F6?_F8G_F:O_F<W_F>
129
M__F@'_JB/_JD7_JF?_JHG_JJO_JLW_JN__JP'_NR/_NT7_NV?_NXG_NZO_N\
130
MW_N^__O`'_S"/_S$7_S&?_S(G_S*O_S,W_S.__S0'_W2/_W47_W6?_W8G_W:
131
MO_W<W_W>__W@'_[B/_[D7_[F?_[HG_[JO_[LW_[N__[P'__R/__T7__V?__X
132
MG__ZO__\W__^__\`,``*P`%(``N@`3R`"#`!*L`%R``;H`-\@!`P`DK`"4@!
133
M*Z`%O(`8,`-JP`W(`3N@!_R`(#`$BL`12`)+H`D\@2@P!:K`%<@"6Z`+?($P
134
M,`;*P!E(`VN@#;R!.#`'ZL`=R`-[H`_\@4`P"`K!(4@$BZ`1/()(,`DJP27(
135
M!)N@$WR"4#`*2L$I2`6KH!6\@E@P"VK!+<@%NZ`7_()@,`R*P3%(!LN@&3R#
136
M:#`-JL$UR`;;H!M\@W`P#LK!.4@'ZZ`=O(-X,`_JP3W(!_N@'_R#@#`0"L)!
137
M2`@+H2$\A(@P$2K"1<@(&Z$C?(20,!)*PDE("2NA);R$F#`3:L)-R`D[H2?\
138
MA*`P%(K"44@*2Z$I/(6H,!6JPE7("ENA*WR%L#`6RL)92`MKH2V\A;@P%^K"
139
M7<@+>Z$O_(7`,!@*PV%(#(NA,3R&R#`9*L-ER`R;H3-\AM`P&DK#:4@-JZ$U
140
MO(;8,!MJPVW(#;NA-_R&X#`<BL-Q2`[+H3D\A^@P':K#=<@.VZ$[?(?P,![*
141
MPWE(#^NA/;R'^#`?ZL-]R`_[H3_\AP`Q(`K$@4@0"Z)!/(@(,2$JQ(7($!NB
142
M0WR($#$B2L2)2!%ID@)8"`TA+6C$C8@11$)'6`D;02C4@+;`$E!"6&`+,@$E
143
MBH08T!-@`@UP"40!!G#$F4@3FT)6D`H;@2I8!8UX!]!`&2@#;"`ML(63*!-J
144
MHE$\BD@Q*2K%I<@4FZ)3?(I0,2I*Q:E(%:NB5;R*6#$K:L6MR!6[HE?\BF`Q
145
M+(K%L4@6RZ)9/(MH,2VJQ;7(%MNB6WR+<#$NRL6Y2!?KHEV\BW@Q+^K%O<@7
146
M^Z)?_(N`,3`*QL%(&`NC83R,B#$Q*L;%R!@;HV-\C)`Q,DK&R4@9*Z-EO(R8
147
),3-JQLW(&0$C
148
`
149
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_xar.c (-3 / +34 lines)
Lines 620-626 has the corresponding timestamps unset. Link Here
620
  archive_write_set_format_xar(a);
620
  archive_write_set_format_xar(a);
621
  archive_write_add_filter_none(a);
621
  archive_write_add_filter_none(a);
622
  size_t used, buffsize = 1500;
622
  size_t used, buffsize = 1500;
623
  char *buff = (char*) malloc(buffsize);
623
  char *buff = malloc(buffsize);
624
  archive_write_open_memory(a, buff, buffsize, &used);
624
  archive_write_open_memory(a, buff, buffsize, &used);
625
625
626
  struct archive_entry *ae = archive_entry_new();
626
  struct archive_entry *ae = archive_entry_new();
Lines 827-833 static void verifyB(unsigned char *d, size_t s) { Link Here
827
	assertA(0 == archive_read_next_header(a, &entry));
827
	assertA(0 == archive_read_next_header(a, &entry));
828
	buf_size = (size_t) archive_entry_size(entry);
828
	buf_size = (size_t) archive_entry_size(entry);
829
	assertA(buf_size == 12);
829
	assertA(buf_size == 12);
830
	buf = (unsigned char*) malloc(buf_size);
830
	buf = malloc(buf_size);
831
	assertA(NULL != buf);
831
	assertA(NULL != buf);
832
	assertA(buf_size == (size_t) archive_read_data(a, buf, buf_size));
832
	assertA(buf_size == (size_t) archive_read_data(a, buf, buf_size));
833
	free(buf);
833
	free(buf);
Lines 836-842 static void verifyB(unsigned char *d, size_t s) { Link Here
836
	assertA(0 == archive_read_next_header(a, &entry));
836
	assertA(0 == archive_read_next_header(a, &entry));
837
	buf_size = (size_t) archive_entry_size(entry);
837
	buf_size = (size_t) archive_entry_size(entry);
838
	assertA(buf_size == 12);
838
	assertA(buf_size == 12);
839
	buf = (unsigned char*) malloc(buf_size);
839
	buf = malloc(buf_size);
840
	assertA(NULL != buf);
840
	assertA(NULL != buf);
841
	assertA(buf_size == (size_t) archive_read_data(a, buf, buf_size));
841
	assertA(buf_size == (size_t) archive_read_data(a, buf, buf_size));
842
	free(buf);
842
	free(buf);
Lines 860-862 DEFINE_TEST(test_read_format_xar) Link Here
860
        verify(archive12, sizeof(archive12), verify12, NULL, GZIP);
860
        verify(archive12, sizeof(archive12), verify12, NULL, GZIP);
861
	verifyB(archive13, sizeof(archive13));
861
	verifyB(archive13, sizeof(archive13));
862
}
862
}
863
864
DEFINE_TEST(test_read_format_xar_duplicate_filename_node)
865
{
866
	static const char *reffiles[] =
867
	{
868
		"test_read_format_xar_duplicate_filename_node.xar",
869
		NULL
870
	};
871
	struct archive_entry *ae;
872
	struct archive *a;
873
	int r;
874
875
	extract_reference_files(reffiles);
876
	assert((a = archive_read_new()) != NULL);
877
	assertA(0 == archive_read_support_filter_all(a));
878
879
	r = archive_read_support_format_xar(a);
880
	if (r == ARCHIVE_WARN) {
881
		skipping("xar reading not fully supported on this platform");
882
		assertEqualInt(ARCHIVE_OK, archive_read_free(a));
883
		return;
884
	}
885
886
	assertA(0 == archive_read_open_filenames(a, reffiles, 10240));
887
888
	assertA(0 == archive_read_next_header(a, &ae));
889
	assertEqualString("File", archive_entry_pathname(ae));
890
891
	assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
892
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
893
}
(-)b/contrib/libarchive/libarchive/test/test_read_format_xar_duplicate_filename_node.xar.uu (+14 lines)
Added Link Here
1
begin 644 test_read_format_xar_duplicate_filename_node.xar
2
M>&%R(0`<``$````````!EP````````.]`````7B<A5-);H,P%-U7ZAT0>VIC
3
MC('((;N<H-UT][$-L<H0@1,E.7T-`0H=TI6?__OSP'>7JG3.JNUT4V]=_P6[
4
MCJI%(W5=;-VWU[T7N[OT^8E?H+6/XW#3B`%8*%H%QMIY1E<J)9A0#S//IZ\$
5
M;PC=^(RCM<ID=U#BHSM53F>NI=JZW0%\=R0MW>1YITR*.1K1S'3ZUL?A:`"C
6
M-S2YFP2Y+I6CI:UFX;0&&W]O&8X&^#]AKD>5Y@,QP)G0=2-M&E'"DIBC^V\F
7
MI3IKH>HF]0-&68!]PM$LF[6JW@8S9CM4K<Q/6O:%]\\L*^ZR8BD3O[<<)^^V
8
M'XM>][$>J%9K57B@"FM5"0;FG_V7JB[,(?5MHB-<D.,<R<^1SD-=S7203VLX
9
M;0D<CZ46PS:ABU?<]-%UT-(`6G'09R6]W_<KIG$LJ9\%"6!)"&80R#`)<"!R
10
M'(DL)T`CH2384K\[6J5U,2T(\V>8#&+(0L`DQED2!@!)1(,PS^.$,I&)+"-1
11
M&`*)./KIZ:N]:-%?COHMO%\?NI\?1_T]?@(L`P/8\;44V2:R;"\D48GC?CRL
12
C(UAG)C5XG./E`@``)@`8>)R%4TEN@S`4W5?J'1![:F.,@<@`
13
`
14
end
(-)b/contrib/libarchive/libarchive/test/test_read_format_zip_nested.c (-1 / +1 lines)
Lines 49-55 DEFINE_TEST(test_read_format_zip_nested) Link Here
49
49
50
	/* Save contents of inner Zip. */
50
	/* Save contents of inner Zip. */
51
	innerLength = (size_t)archive_entry_size(ae);
51
	innerLength = (size_t)archive_entry_size(ae);
52
	inner = calloc(innerLength, sizeof(char));
52
	inner = calloc(innerLength, sizeof(*inner));
53
	assertEqualInt(innerLength, archive_read_data(a, inner, innerLength));
53
	assertEqualInt(innerLength, archive_read_data(a, inner, innerLength));
54
54
55
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
55
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
(-)b/contrib/libarchive/libarchive/test/test_read_format_zip_traditional_encryption_data.c (-1 / +1 lines)
Lines 41-47 DEFINE_TEST(test_read_format_zip_traditional_encryption_data) Link Here
41
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
41
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
42
	if (ARCHIVE_OK != archive_write_set_options(a,
42
	if (ARCHIVE_OK != archive_write_set_options(a,
43
				"zip:encryption=traditional")) {
43
				"zip:encryption=traditional")) {
44
		skipping("This system does not have cryptographic liberary");
44
		skipping("This system does not have cryptographic library");
45
		archive_write_free(a);
45
		archive_write_free(a);
46
		return;
46
		return;
47
	}
47
	}
(-)b/contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes.c (-1 / +1 lines)
Lines 38-44 test_winzip_aes(const char *refname, int need_libz) Link Here
38
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
38
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
39
	if (ARCHIVE_OK != archive_write_set_options(a,
39
	if (ARCHIVE_OK != archive_write_set_options(a,
40
				"zip:encryption=aes256")) {
40
				"zip:encryption=aes256")) {
41
		skipping("This system does not have cryptographic liberary");
41
		skipping("This system does not have cryptographic library");
42
		archive_write_free(a);
42
		archive_write_free(a);
43
		return;
43
		return;
44
	}
44
	}
(-)b/contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes_large.c (-1 / +1 lines)
Lines 39-45 DEFINE_TEST(test_read_format_zip_winzip_aes256_large) Link Here
39
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
39
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
40
	if (ARCHIVE_OK != archive_write_set_options(a,
40
	if (ARCHIVE_OK != archive_write_set_options(a,
41
				"zip:encryption=aes256")) {
41
				"zip:encryption=aes256")) {
42
		skipping("This system does not have cryptographic liberary");
42
		skipping("This system does not have cryptographic library");
43
		archive_write_free(a);
43
		archive_write_free(a);
44
		return;
44
		return;
45
	}
45
	}
(-)b/contrib/libarchive/libarchive/test/test_read_truncated_filter.c (-2 / +2 lines)
Lines 43-54 test_truncation(const char *compression, Link Here
43
	int i, r, use_prog;
43
	int i, r, use_prog;
44
44
45
	buffsize = 2000000;
45
	buffsize = 2000000;
46
	assert(NULL != (buff = (char *)malloc(buffsize)));
46
	assert(NULL != (buff = malloc(buffsize)));
47
	if (buff == NULL)
47
	if (buff == NULL)
48
		return;
48
		return;
49
49
50
	datasize = 10000;
50
	datasize = 10000;
51
	assert(NULL != (data = (char *)malloc(datasize)));
51
	assert(NULL != (data = malloc(datasize)));
52
	if (data == NULL) {
52
	if (data == NULL) {
53
		free(buff);
53
		free(buff);
54
		return;
54
		return;
(-)b/contrib/libarchive/libarchive/test/test_sparse_basic.c (-7 / +10 lines)
Lines 67-79 struct sparse { Link Here
67
67
68
static void create_sparse_file(const char *, const struct sparse *);
68
static void create_sparse_file(const char *, const struct sparse *);
69
69
70
#if defined(__APPLE__)
70
/* This should be large enough that any OS/filesystem that
71
/* On APFS holes need to be at least 4096x4097 bytes */
71
 * does support sparse files is certain to store a gap this big
72
#define MIN_HOLE 16781312
72
 * as a hole. */
73
#else
73
/* A few data points:
74
/* Elsewhere we work with 4096*10 bytes */
74
 * = ZFS on FreeBSD needs this to be at least 200kB
75
#define MIN_HOLE 409600
75
 * = macOS APFS needs this to be at least 4096x4097 bytes
76
#endif
76
 *
77
 * 32MiB here is bigger than either of the above.
78
 */
79
#define MIN_HOLE (32 * 1024UL * 1024UL)
77
80
78
#if defined(_WIN32) && !defined(__CYGWIN__)
81
#if defined(_WIN32) && !defined(__CYGWIN__)
79
#include <winioctl.h>
82
#include <winioctl.h>
(-)b/contrib/libarchive/libarchive/test/test_tar_large.c (-1 / +1 lines)
Lines 99-105 memory_write(struct archive *a, void *_private, const void *buff, size_t size) Link Here
99
	} else {
99
	} else {
100
		/* Yes, we're assuming the very first write is metadata. */
100
		/* Yes, we're assuming the very first write is metadata. */
101
		/* It's header or metadata, copy and save it. */
101
		/* It's header or metadata, copy and save it. */
102
		block = (struct memblock *)malloc(sizeof(*block));
102
		block = malloc(sizeof(*block));
103
		memset(block, 0, sizeof(*block));
103
		memset(block, 0, sizeof(*block));
104
		block->size = size;
104
		block->size = size;
105
		block->buff = malloc(size);
105
		block->buff = malloc(size);
(-)b/contrib/libarchive/libarchive/test/test_ustar_filename_encoding.c (+102 lines)
Lines 390-392 DEFINE_TEST(test_ustar_filename_encoding_CP932_UTF8) Link Here
390
	assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
390
	assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
391
}
391
}
392
392
393
DEFINE_TEST(test_ustar_filename_encoding_UTF16_win)
394
{
395
#if !defined(_WIN32) || defined(__CYGWIN__)
396
	skipping("This test is meant to verify unicode string handling"
397
		" on Windows with UTF-16 names");
398
	return;
399
#else
400
	struct archive *a;
401
	struct archive_entry *entry;
402
	char buff[4096];
403
	size_t used;
404
405
	/*
406
	 * Don't call setlocale because we're verifying that the '_w' functions
407
	 * work as expected when 'hdrcharset' is UTF-8
408
	 */
409
410
	/* Part 1: file */
411
	a = archive_write_new();
412
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
413
	if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
414
		skipping("This system cannot convert character-set"
415
		    " from UTF-16 to UTF-8.");
416
		archive_write_free(a);
417
		return;
418
	}
419
	assertEqualInt(ARCHIVE_OK,
420
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
421
422
	entry = archive_entry_new2(a);
423
	/* Set the filename using a UTF-16 string */
424
	archive_entry_copy_pathname_w(entry, L"\u8868.txt");
425
	archive_entry_set_filetype(entry, AE_IFREG);
426
	archive_entry_set_size(entry, 0);
427
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
428
	archive_entry_free(entry);
429
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
430
431
	/* Check UTF-8 version. */
432
	assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7);
433
434
	/* Part 2: directory */
435
	a = archive_write_new();
436
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
437
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
438
	assertEqualInt(ARCHIVE_OK,
439
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
440
441
	entry = archive_entry_new2(a);
442
	/* Set the directory name using a UTF-16 string */
443
	/* NOTE: Explicitly not adding trailing slash to test that code path */
444
	archive_entry_copy_pathname_w(entry, L"\u8868");
445
	archive_entry_set_filetype(entry, AE_IFDIR);
446
	archive_entry_set_size(entry, 0);
447
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
448
	archive_entry_free(entry);
449
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
450
451
	/* Check UTF-8 version. */
452
	assertEqualMem(buff, "\xE8\xA1\xA8/", 4);
453
454
	/* Part 3: symlink */
455
	a = archive_write_new();
456
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
457
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
458
	assertEqualInt(ARCHIVE_OK,
459
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
460
461
	entry = archive_entry_new2(a);
462
	/* Set the symlink target using a UTF-16 string */
463
	archive_entry_set_pathname(entry, "link.txt");
464
	archive_entry_copy_symlink_w(entry, L"\u8868.txt");
465
	archive_entry_set_filetype(entry, AE_IFLNK);
466
	archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
467
	archive_entry_set_size(entry, 0);
468
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
469
	archive_entry_free(entry);
470
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
471
472
	/* Check UTF-8 version. */
473
	assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
474
475
	/* Part 4: hardlink */
476
	a = archive_write_new();
477
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_ustar(a));
478
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
479
	assertEqualInt(ARCHIVE_OK,
480
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
481
482
	entry = archive_entry_new2(a);
483
	/* Set the symlink target using a UTF-16 string */
484
	archive_entry_set_pathname(entry, "link.txt");
485
	archive_entry_copy_hardlink_w(entry, L"\u8868.txt");
486
	archive_entry_set_size(entry, 0);
487
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
488
	archive_entry_free(entry);
489
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
490
491
	/* Check UTF-8 version. */
492
	assertEqualMem(buff + 157, "\xE8\xA1\xA8.txt", 7);
493
#endif
494
}
(-)b/contrib/libarchive/libarchive/test/test_write_disk_secure_noabsolutepaths.c (+88 lines)
Added Link Here
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
4
 * Copyright (c) 2024 Mostyn Bramley-Moore <mostyn@antipode.se>
5
 */
6
7
#include "test.h"
8
9
#include <stdlib.h>
10
11
#if defined(_WIN32) && !defined(__CYGWIN__)
12
#define UNLINK _unlink
13
#else
14
#include <unistd.h>
15
#define UNLINK unlink
16
#endif
17
18
/*
19
 * Exercise security checks that should prevent writing absolute paths
20
 * when extracting archives.
21
 */
22
DEFINE_TEST(test_write_disk_secure_noabsolutepaths)
23
{
24
	struct archive *a, *ad;
25
	struct archive_entry *ae;
26
27
	char buff[10000];
28
29
	size_t used;
30
31
	// Create an archive_write object.
32
	assert((a = archive_write_new()) != NULL);
33
	assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a));
34
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
35
	assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used));
36
37
	// Create an absolute path for a test file inside testworkdir.
38
	const char *entry_suffix = "/badfile";
39
	size_t entry_suffix_length = strlen(entry_suffix);
40
	size_t testworkdir_length = strlen(testworkdir);
41
	size_t temp_absolute_file_name_length = testworkdir_length + entry_suffix_length;
42
	char *temp_absolute_file_name = calloc(1, temp_absolute_file_name_length + 1); // +1 for null character.
43
	assertEqualInt(snprintf(temp_absolute_file_name, temp_absolute_file_name_length + 1, "%s%s", testworkdir, entry_suffix),
44
		temp_absolute_file_name_length);
45
46
	// Convert to a unix-style path, so we can compare it to the entry
47
	// path when reading back the archive.
48
	for (char *p = temp_absolute_file_name; *p != '\0'; p++)
49
		if (*p == '\\') *p = '/';
50
51
	// Add a regular file entry with an absolute path.
52
	assert((ae = archive_entry_new()) != NULL);
53
	archive_entry_copy_pathname(ae, temp_absolute_file_name);
54
	archive_entry_set_mode(ae, S_IFREG | 0777);
55
	archive_entry_set_size(ae, 6);
56
	assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
57
	archive_entry_free(ae);
58
	assertEqualInt(6, archive_write_data(a, "hello", 6));
59
	assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
60
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
61
62
	// Now try to extract the data.
63
	assert((a = archive_read_new()) != NULL);
64
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
65
	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
66
	assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used));
67
68
	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
69
	assertEqualString(temp_absolute_file_name, archive_entry_pathname(ae));
70
	assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
71
	assertEqualInt(AE_IFREG | 0777, archive_entry_mode(ae));
72
	assertEqualInt(6, archive_entry_size(ae));
73
74
	// This should succeed.
75
	assertEqualInt(ARCHIVE_OK, archive_read_extract(a, ae, 0));
76
	UNLINK(temp_absolute_file_name);
77
78
	// This should fail, since the archive entry has an absolute path.
79
	assert(ARCHIVE_OK != archive_read_extract(a, ae, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS));
80
81
	// This should also fail.
82
	assert((ad = archive_write_new()) != NULL);
83
	assertEqualInt(ARCHIVE_OK, archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS));
84
	assert(ARCHIVE_OK != archive_read_extract2(a, ae, ad));
85
86
	assertEqualInt(ARCHIVE_OK, archive_write_free(ad));
87
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
88
}
(-)b/contrib/libarchive/libarchive/test/test_write_filter_b64encode.c (-2 / +2 lines)
Lines 41-50 DEFINE_TEST(test_write_filter_b64encode) Link Here
41
	int i;
41
	int i;
42
42
43
	buffsize = 2000000;
43
	buffsize = 2000000;
44
	assert(NULL != (buff = (char *)malloc(buffsize)));
44
	assert(NULL != (buff = malloc(buffsize)));
45
45
46
	datasize = 10000;
46
	datasize = 10000;
47
	assert(NULL != (data = (char *)malloc(datasize)));
47
	assert(NULL != (data = malloc(datasize)));
48
	memset(data, 0, datasize);
48
	memset(data, 0, datasize);
49
49
50
	/*
50
	/*
(-)b/contrib/libarchive/libarchive/test/test_write_filter_bzip2.c (-2 / +2 lines)
Lines 43-54 DEFINE_TEST(test_write_filter_bzip2) Link Here
43
	int i, r, use_prog;
43
	int i, r, use_prog;
44
44
45
	buffsize = 2000000;
45
	buffsize = 2000000;
46
	assert(NULL != (buff = (char *)malloc(buffsize)));
46
	assert(NULL != (buff = malloc(buffsize)));
47
	if (buff == NULL)
47
	if (buff == NULL)
48
		return;
48
		return;
49
49
50
	datasize = 10000;
50
	datasize = 10000;
51
	assert(NULL != (data = (char *)malloc(datasize)));
51
	assert(NULL != (data = malloc(datasize)));
52
	if (data == NULL) {
52
	if (data == NULL) {
53
		free(buff);
53
		free(buff);
54
		return;
54
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_filter_compress.c (-2 / +2 lines)
Lines 43-52 DEFINE_TEST(test_write_filter_compress) Link Here
43
	int i;
43
	int i;
44
44
45
	buffsize = 1000000;
45
	buffsize = 1000000;
46
	assert(NULL != (buff = (char *)malloc(buffsize)));
46
	assert(NULL != (buff = malloc(buffsize)));
47
47
48
	datasize = 10000;
48
	datasize = 10000;
49
	assert(NULL != (data = (char *)malloc(datasize)));
49
	assert(NULL != (data = malloc(datasize)));
50
	memset(data, 0, datasize);
50
	memset(data, 0, datasize);
51
51
52
	assert((a = archive_write_new()) != NULL);
52
	assert((a = archive_write_new()) != NULL);
(-)b/contrib/libarchive/libarchive/test/test_write_filter_gzip.c (-2 / +2 lines)
Lines 44-55 DEFINE_TEST(test_write_filter_gzip) Link Here
44
	int i, r, use_prog = 0;
44
	int i, r, use_prog = 0;
45
45
46
	buffsize = 2000000;
46
	buffsize = 2000000;
47
	assert(NULL != (buff = (char *)malloc(buffsize)));
47
	assert(NULL != (buff = malloc(buffsize)));
48
	if (buff == NULL)
48
	if (buff == NULL)
49
		return;
49
		return;
50
50
51
	datasize = 10000;
51
	datasize = 10000;
52
	assert(NULL != (data = (char *)malloc(datasize)));
52
	assert(NULL != (data = malloc(datasize)));
53
	if (data == NULL) {
53
	if (data == NULL) {
54
		free(buff);
54
		free(buff);
55
		return;
55
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_filter_gzip_timestamp.c (-2 / +2 lines)
Lines 37-48 DEFINE_TEST(test_write_filter_gzip_timestamp) Link Here
37
	int r, use_prog = 0;
37
	int r, use_prog = 0;
38
38
39
	buffsize = 10000;
39
	buffsize = 10000;
40
	assert(NULL != (buff = (char *)malloc(buffsize)));
40
	assert(NULL != (buff = malloc(buffsize)));
41
	if (buff == NULL)
41
	if (buff == NULL)
42
		return;
42
		return;
43
43
44
	datasize = 10000;
44
	datasize = 10000;
45
	assert(NULL != (data = (char *)malloc(datasize)));
45
	assert(NULL != (data = malloc(datasize)));
46
	if (data == NULL) {
46
	if (data == NULL) {
47
		free(buff);
47
		free(buff);
48
		return;
48
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_filter_lrzip.c (-2 / +2 lines)
Lines 46-55 DEFINE_TEST(test_write_filter_lrzip) Link Here
46
	}
46
	}
47
47
48
	buffsize = 2000000;
48
	buffsize = 2000000;
49
	assert(NULL != (buff = (char *)malloc(buffsize)));
49
	assert(NULL != (buff = malloc(buffsize)));
50
50
51
	datasize = 10000;
51
	datasize = 10000;
52
	assert(NULL != (data = (char *)malloc(datasize)));
52
	assert(NULL != (data = malloc(datasize)));
53
	memset(data, 0, datasize);
53
	memset(data, 0, datasize);
54
54
55
	/*
55
	/*
(-)b/contrib/libarchive/libarchive/test/test_write_filter_lz4.c (-4 / +4 lines)
Lines 58-67 DEFINE_TEST(test_write_filter_lz4) Link Here
58
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
58
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
59
59
60
	buffsize = 2000000;
60
	buffsize = 2000000;
61
	assert(NULL != (buff = (char *)malloc(buffsize)));
61
	assert(NULL != (buff = malloc(buffsize)));
62
62
63
	datasize = 10000;
63
	datasize = 10000;
64
	assert(NULL != (data = (char *)calloc(datasize, 1)));
64
	assert(NULL != (data = calloc(datasize, 1)));
65
	filecount = 10;
65
	filecount = 10;
66
66
67
	/*
67
	/*
Lines 302-311 test_options(const char *options) Link Here
302
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
302
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
303
303
304
	buffsize = 2000000;
304
	buffsize = 2000000;
305
	assert(NULL != (buff = (char *)malloc(buffsize)));
305
	assert(NULL != (buff = malloc(buffsize)));
306
306
307
	datasize = 10000;
307
	datasize = 10000;
308
	assert(NULL != (data = (char *)calloc(datasize, 1)));
308
	assert(NULL != (data = calloc(datasize, 1)));
309
	filecount = 10;
309
	filecount = 10;
310
310
311
	/*
311
	/*
(-)b/contrib/libarchive/libarchive/test/test_write_filter_lzip.c (-2 / +2 lines)
Lines 43-54 DEFINE_TEST(test_write_filter_lzip) Link Here
43
	int i, r;
43
	int i, r;
44
44
45
	buffsize = 2000000;
45
	buffsize = 2000000;
46
	assert(NULL != (buff = (char *)malloc(buffsize)));
46
	assert(NULL != (buff = malloc(buffsize)));
47
	if (buff == NULL)
47
	if (buff == NULL)
48
		return;
48
		return;
49
49
50
	datasize = 10000;
50
	datasize = 10000;
51
	assert(NULL != (data = (char *)malloc(datasize)));
51
	assert(NULL != (data = malloc(datasize)));
52
	if (data == NULL) {
52
	if (data == NULL) {
53
		free(buff);
53
		free(buff);
54
		return;
54
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_filter_lzma.c (-2 / +2 lines)
Lines 42-53 DEFINE_TEST(test_write_filter_lzma) Link Here
42
	int i, r;
42
	int i, r;
43
43
44
	buffsize = 2000000;
44
	buffsize = 2000000;
45
	assert(NULL != (buff = (char *)malloc(buffsize)));
45
	assert(NULL != (buff = malloc(buffsize)));
46
	if (buff == NULL)
46
	if (buff == NULL)
47
		return;
47
		return;
48
48
49
	datasize = 10000;
49
	datasize = 10000;
50
	assert(NULL != (data = (char *)malloc(datasize)));
50
	assert(NULL != (data = malloc(datasize)));
51
	if (data == NULL) {
51
	if (data == NULL) {
52
		free(buff);
52
		free(buff);
53
		return;
53
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_filter_lzop.c (-2 / +2 lines)
Lines 52-61 DEFINE_TEST(test_write_filter_lzop) Link Here
52
	}
52
	}
53
53
54
	buffsize = 2000000;
54
	buffsize = 2000000;
55
	assert(NULL != (buff = (char *)malloc(buffsize)));
55
	assert(NULL != (buff = malloc(buffsize)));
56
56
57
	datasize = 10000;
57
	datasize = 10000;
58
	assert(NULL != (data = (char *)calloc(datasize, 1)));
58
	assert(NULL != (data = calloc(datasize, 1)));
59
	filecount = 10;
59
	filecount = 10;
60
60
61
	/*
61
	/*
(-)b/contrib/libarchive/libarchive/test/test_write_filter_uuencode.c (-2 / +2 lines)
Lines 41-50 DEFINE_TEST(test_write_filter_uuencode) Link Here
41
	int i;
41
	int i;
42
42
43
	buffsize = 2000000;
43
	buffsize = 2000000;
44
	assert(NULL != (buff = (char *)malloc(buffsize)));
44
	assert(NULL != (buff = malloc(buffsize)));
45
45
46
	datasize = 10000;
46
	datasize = 10000;
47
	assert(NULL != (data = (char *)malloc(datasize)));
47
	assert(NULL != (data = malloc(datasize)));
48
	memset(data, 0, datasize);
48
	memset(data, 0, datasize);
49
49
50
	/*
50
	/*
(-)b/contrib/libarchive/libarchive/test/test_write_filter_xz.c (-2 / +2 lines)
Lines 43-54 DEFINE_TEST(test_write_filter_xz) Link Here
43
	int i, r;
43
	int i, r;
44
44
45
	buffsize = 2000000;
45
	buffsize = 2000000;
46
	assert(NULL != (buff = (char *)malloc(buffsize)));
46
	assert(NULL != (buff = malloc(buffsize)));
47
	if (buff == NULL)
47
	if (buff == NULL)
48
		return;
48
		return;
49
49
50
	datasize = 10000;
50
	datasize = 10000;
51
	assert(NULL != (data = (char *)malloc(datasize)));
51
	assert(NULL != (data = malloc(datasize)));
52
	if (data == NULL) {
52
	if (data == NULL) {
53
		free(buff);
53
		free(buff);
54
		return;
54
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_filter_zstd.c (-8 / +4 lines)
Lines 37-48 DEFINE_TEST(test_write_filter_zstd) Link Here
37
	int i, r;
37
	int i, r;
38
38
39
	buffsize = 2000000;
39
	buffsize = 2000000;
40
	assert(NULL != (buff = (char *)malloc(buffsize)));
40
	assert(NULL != (buff = malloc(buffsize)));
41
	if (buff == NULL)
41
	if (buff == NULL)
42
		return;
42
		return;
43
43
44
	datasize = 10000;
44
	datasize = 10000;
45
	assert(NULL != (data = (char *)malloc(datasize)));
45
	assert(NULL != (data = malloc(datasize)));
46
	if (data == NULL) {
46
	if (data == NULL) {
47
		free(buff);
47
		free(buff);
48
		return;
48
		return;
Lines 230-241 DEFINE_TEST(test_write_filter_zstd) Link Here
230
	    archive_write_set_filter_option(a, NULL, "max-frame-out", "1GB"));
230
	    archive_write_set_filter_option(a, NULL, "max-frame-out", "1GB"));
231
#endif
231
#endif
232
#if ZSTD_VERSION_NUMBER >= MINVER_LONG
232
#if ZSTD_VERSION_NUMBER >= MINVER_LONG
233
	if ((int)(sizeof(size_t) == 4))
233
	assertEqualIntA(a, ARCHIVE_OK,
234
		assertEqualIntA(a, ARCHIVE_OK,
234
	    archive_write_set_filter_option(a, NULL, "long", "23"));
235
		    archive_write_set_filter_option(a, NULL, "long", "26"));
236
	else
237
		assertEqualIntA(a, ARCHIVE_OK,
238
		    archive_write_set_filter_option(a, NULL, "long", "27"));
239
	assertEqualIntA(a, ARCHIVE_FAILED,
235
	assertEqualIntA(a, ARCHIVE_FAILED,
240
	    archive_write_set_filter_option(a, NULL, "long", "-1")); /* negative */
236
	    archive_write_set_filter_option(a, NULL, "long", "-1")); /* negative */
241
#endif
237
#endif
(-)b/contrib/libarchive/libarchive/test/test_write_format_iso9660_filename.c (-1 / +1 lines)
Lines 321-327 DEFINE_TEST(test_write_format_iso9660_filename) Link Here
321
	 */
321
	 */
322
	fcnt = create_iso_image(buff, buffsize, &used, NULL);
322
	fcnt = create_iso_image(buff, buffsize, &used, NULL);
323
323
324
	fns.names = (char **)malloc(sizeof(char *) * fcnt);
324
	fns.names = malloc(sizeof(char *) * fcnt);
325
	assert(fns.names != NULL);
325
	assert(fns.names != NULL);
326
	if (fns.names == NULL) {
326
	if (fns.names == NULL) {
327
		free(buff);
327
		free(buff);
(-)b/contrib/libarchive/libarchive/test/test_write_format_zip.c (-3 / +3 lines)
Lines 699-705 DEFINE_TEST(test_write_format_zip_traditional_pkware_encryption) Link Here
699
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
699
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
700
	if (ARCHIVE_OK != archive_write_set_options(a,
700
	if (ARCHIVE_OK != archive_write_set_options(a,
701
		    "zip:encryption=zipcrypt")) {
701
		    "zip:encryption=zipcrypt")) {
702
		skipping("This system does not have cryptographic liberary");
702
		skipping("This system does not have cryptographic library");
703
		archive_write_free(a);
703
		archive_write_free(a);
704
		free(buff);
704
		free(buff);
705
		return;
705
		return;
Lines 779-785 DEFINE_TEST(test_write_format_zip_winzip_aes128_encryption) Link Here
779
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
779
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
780
	if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes128"))
780
	if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes128"))
781
	{
781
	{
782
		skipping("This system does not have cryptographic liberary");
782
		skipping("This system does not have cryptographic library");
783
		archive_write_free(a);
783
		archive_write_free(a);
784
		free(buff);
784
		free(buff);
785
		return;
785
		return;
Lines 859-865 DEFINE_TEST(test_write_format_zip_winzip_aes256_encryption) Link Here
859
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
859
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
860
	if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes256"))
860
	if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes256"))
861
	{
861
	{
862
		skipping("This system does not have cryptographic liberary");
862
		skipping("This system does not have cryptographic library");
863
		archive_write_free(a);
863
		archive_write_free(a);
864
		free(buff);
864
		free(buff);
865
		return;
865
		return;
(-)b/contrib/libarchive/libarchive/test/test_write_format_zip_entry_size_unset.c (-1 / +1 lines)
Lines 205-211 static void verify_contents(const char *zip_buff, size_t size) Link Here
205
	assertEqualInt(i4(data_descriptor + 4), crc);
205
	assertEqualInt(i4(data_descriptor + 4), crc);
206
	/* Check compressed size */
206
	/* Check compressed size */
207
	assertEqualInt(i4(data_descriptor + 8), sizeof(file_data1) + sizeof(file_data2));
207
	assertEqualInt(i4(data_descriptor + 8), sizeof(file_data1) + sizeof(file_data2));
208
	/* Chcek uncompresed size */
208
	/* Check uncompressed size */
209
	assertEqualInt(i4(data_descriptor + 12), sizeof(file_data1) + sizeof(file_data2));
209
	assertEqualInt(i4(data_descriptor + 12), sizeof(file_data1) + sizeof(file_data2));
210
210
211
	/* Get folder entry in central directory */
211
	/* Get folder entry in central directory */
(-)b/contrib/libarchive/libarchive/test/test_write_format_zip_large.c (-1 / +1 lines)
Lines 96-102 memory_write(struct archive *a, void *_private, const void *buff, size_t size) Link Here
96
	} else {
96
	} else {
97
		/* Yes, we're assuming the very first write is metadata. */
97
		/* Yes, we're assuming the very first write is metadata. */
98
		/* It's header or metadata, copy and save it. */
98
		/* It's header or metadata, copy and save it. */
99
		block = (struct fileblock *)malloc(sizeof(*block));
99
		block = malloc(sizeof(*block));
100
		memset(block, 0, sizeof(*block));
100
		memset(block, 0, sizeof(*block));
101
		block->size = (int)size;
101
		block->size = (int)size;
102
		block->buff = malloc(size);
102
		block->buff = malloc(size);
(-)b/contrib/libarchive/libarchive/test/test_write_format_zip_stream.c (+5 lines)
Lines 71-77 DEFINE_TEST(test_write_format_zip_stream) Link Here
71
	unsigned long crc;
71
	unsigned long crc;
72
	unsigned long compressed_size = 0;
72
	unsigned long compressed_size = 0;
73
	int file_perm = 00644;
73
	int file_perm = 00644;
74
#ifdef HAVE_ZLIB_H
74
	int zip_version = 20;
75
	int zip_version = 20;
76
#else
77
	int zip_version = 10;
78
#endif
75
	int zip_compression = 8;
79
	int zip_compression = 8;
76
	short file_uid = 10, file_gid = 20;
80
	short file_uid = 10, file_gid = 20;
77
	unsigned char *buff, *buffend, *p;
81
	unsigned char *buff, *buffend, *p;
Lines 82-87 DEFINE_TEST(test_write_format_zip_stream) Link Here
82
	const char *file_name = "file";
86
	const char *file_name = "file";
83
87
84
#ifndef HAVE_ZLIB_H
88
#ifndef HAVE_ZLIB_H
89
	zip_version = 10;
85
	zip_compression = 0;
90
	zip_compression = 0;
86
#endif
91
#endif
87
92
(-)b/contrib/libarchive/libarchive/test/test_write_format_zip_windows_path.c (+100 lines)
Added Link Here
1
/*-
2
 * Copyright (c) 2024 Yang Zhou
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "test.h"
28
29
static void
30
test_with_hdrcharset(const char *charset)
31
{
32
	static const char *raw_path = "dir_stored\\dir1/file";
33
	static const char *replaced = "dir_stored/dir1/file";
34
	struct archive *a;
35
	size_t used;
36
	size_t buffsize = 1000000;
37
	char *buff;
38
39
	buff = malloc(buffsize);
40
41
	/* Create a new archive in memory. */
42
	assert((a = archive_write_new()) != NULL);
43
	assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a));
44
	assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a));
45
	if (charset != NULL) {
46
		assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_option(a, "zip", "hdrcharset", charset));
47
	}
48
	assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used));
49
50
	/*
51
	 * Write a file with mixed '/' and '\'
52
	 */
53
	struct archive_entry *ae;
54
	assert((ae = archive_entry_new()) != NULL);
55
	archive_entry_set_mtime(ae, 1, 10);
56
	archive_entry_copy_pathname(ae, raw_path);
57
	archive_entry_set_mode(ae, AE_IFREG | 0755);
58
	archive_entry_set_size(ae, 0);
59
	assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
60
	archive_entry_free(ae);
61
62
	assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
63
	assertEqualIntA(a, ARCHIVE_OK, archive_write_free(a));
64
	dumpfile("constructed.zip", buff, used);
65
66
	/*
67
	 * Check if the generated archive contains and only contains expected path.
68
	 * Intentionally avoid using `archive_read_XXX` functions because it silently replaces '\' with '/',
69
	 * making it difficult to get the exact path written in the archive.
70
	 */
71
#if defined(_WIN32) && !defined(__CYGWIN__)
72
	const char *expected = replaced;
73
	const char *unexpected = raw_path;
74
#else
75
	const char *expected = raw_path;
76
	const char *unexpected = replaced;
77
#endif
78
	int expected_found = 0;
79
	int unexpected_found = 0;
80
	size_t len = strlen(raw_path);
81
	for (char *ptr = buff; ptr < (buff + used - len); ptr++) {
82
		if (memcmp(ptr, expected, len) == 0)
83
			++expected_found;
84
		if (memcmp(ptr, unexpected, len) == 0)
85
			++unexpected_found;
86
	}
87
	failure("should find expected path in both local and central header (charset=%s)", charset);
88
	assertEqualInt(2, expected_found);
89
	failure("should not find unexpected path in anywhere (charset=%s)", charset);
90
	assertEqualInt(0, unexpected_found);
91
}
92
93
DEFINE_TEST(test_write_format_zip_windows_path)
94
{
95
	test_with_hdrcharset(NULL);
96
#if defined(_WIN32) && !defined(__CYGWIN__) || HAVE_ICONV
97
	test_with_hdrcharset("ISO-8859-1");
98
	test_with_hdrcharset("UTF-8");
99
#endif
100
}
(-)b/contrib/libarchive/libarchive/test/test_zip_filename_encoding.c (+95 lines)
Lines 527-529 DEFINE_TEST(test_zip_filename_encoding_CP932) Link Here
527
	assertEqualInt(0, buff[7]);
527
	assertEqualInt(0, buff[7]);
528
	assertEqualMem(buff + 30, "abcABC", 6);
528
	assertEqualMem(buff + 30, "abcABC", 6);
529
}
529
}
530
531
DEFINE_TEST(test_zip_filename_encoding_UTF16_win)
532
{
533
#if !defined(_WIN32) || defined(__CYGWIN__)
534
	skipping("This test is meant to verify unicode string handling"
535
		" on Windows with UTF-16 names");
536
	return;
537
#else
538
	struct archive *a;
539
	struct archive_entry *entry;
540
	char buff[4096];
541
	size_t used;
542
543
	/*
544
	 * Don't call setlocale because we're verifying that the '_w' functions
545
	 * work as expected when 'hdrcharset' is UTF-8
546
	 */
547
548
	/* Part 1: file */
549
	a = archive_write_new();
550
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
551
	if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
552
		skipping("This system cannot convert character-set"
553
		    " from UTF-16 to UTF-8.");
554
		archive_write_free(a);
555
		return;
556
	}
557
	assertEqualInt(ARCHIVE_OK,
558
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
559
560
	entry = archive_entry_new2(a);
561
	/* Set the filename using a UTF-16 string */
562
	archive_entry_copy_pathname_w(entry, L"\u8868.txt");
563
	archive_entry_set_filetype(entry, AE_IFREG);
564
	archive_entry_set_size(entry, 0);
565
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
566
	archive_entry_free(entry);
567
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
568
569
	/* A bit 11 of general purpose flag should be 1,
570
	 * which indicates the filename charset is UTF-8. */
571
	assertEqualInt(0x08, buff[7]);
572
	/* Check UTF-8 version. */
573
	assertEqualMem(buff + 30, "\xE8\xA1\xA8.txt", 7);
574
575
	/* Part 2: directory */
576
	a = archive_write_new();
577
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
578
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
579
	assertEqualInt(ARCHIVE_OK,
580
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
581
582
	entry = archive_entry_new2(a);
583
	/* Set the directory name using a UTF-16 string */
584
	/* NOTE: Explicitly not adding trailing slash to test that code path */
585
	archive_entry_copy_pathname_w(entry, L"\u8868");
586
	archive_entry_set_filetype(entry, AE_IFDIR);
587
	archive_entry_set_size(entry, 0);
588
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
589
	archive_entry_free(entry);
590
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
591
592
	/* A bit 11 of general purpose flag should be 1,
593
	 * which indicates the filename charset is UTF-8. */
594
	assertEqualInt(0x08, buff[7]);
595
	/* Check UTF-8 version. */
596
	assertEqualMem(buff+ 30, "\xE8\xA1\xA8/", 4);
597
598
	/* Part 3: symlink */
599
	a = archive_write_new();
600
	assertEqualInt(ARCHIVE_OK, archive_write_set_format_zip(a));
601
	assertEqualInt(ARCHIVE_OK, archive_write_set_options(a, "hdrcharset=UTF-8"));
602
	assertEqualInt(ARCHIVE_OK,
603
	    archive_write_open_memory(a, buff, sizeof(buff), &used));
604
605
	entry = archive_entry_new2(a);
606
	/* Set the symlink target using a UTF-16 string */
607
	archive_entry_set_pathname(entry, "link.txt");
608
	archive_entry_copy_symlink_w(entry, L"\u8868.txt");
609
	archive_entry_set_filetype(entry, AE_IFLNK);
610
	archive_entry_set_symlink_type(entry, AE_SYMLINK_TYPE_FILE);
611
	archive_entry_set_size(entry, 0);
612
	assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
613
	archive_entry_free(entry);
614
	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
615
616
	/* A bit 11 of general purpose flag should be 0,
617
	 * because the file name is ASCII. */
618
	assertEqualInt(0, buff[7]);
619
	/* Check UTF-8 version. */
620
	assertEqualMem(buff + 38, "\xE8\xA1\xA8.txt", 7);
621
622
	/* NOTE: ZIP does not support hardlinks */
623
#endif
624
}
(-)b/contrib/libarchive/tar/bsdtar.1 (-21 / +3 lines)
Lines 1-28 Link Here
1
.\"
2
.\" SPDX-License-Identifier: BSD-2-Clause
3
.\"
1
.\" Copyright (c) 2003-2007 Tim Kientzle
4
.\" Copyright (c) 2003-2007 Tim Kientzle
2
.\" Copyright (c) 2017 Martin Matuska
5
.\" Copyright (c) 2017 Martin Matuska
3
.\" All rights reserved.
6
.\" All rights reserved.
4
.\"
7
.\"
5
.\" Redistribution and use in source and binary forms, with or without
6
.\" modification, are permitted provided that the following conditions
7
.\" are met:
8
.\" 1. Redistributions of source code must retain the above copyright
9
.\"    notice, this list of conditions and the following disclaimer.
10
.\" 2. Redistributions in binary form must reproduce the above copyright
11
.\"    notice, this list of conditions and the following disclaimer in the
12
.\"    documentation and/or other materials provided with the distribution.
13
.\"
14
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
.\" SUCH DAMAGE.
25
.\"
26
.Dd April 23, 2024
8
.Dd April 23, 2024
27
.Dt TAR 1
9
.Dt TAR 1
28
.Os
10
.Os
(-)b/contrib/libarchive/tar/bsdtar.c (-20 / +5 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#include "bsdtar_platform.h"
8
#include "bsdtar_platform.h"
Lines 43-48 Link Here
43
#ifdef HAVE_LANGINFO_H
25
#ifdef HAVE_LANGINFO_H
44
#include <langinfo.h>
26
#include <langinfo.h>
45
#endif
27
#endif
28
#ifdef HAVE_LIMITS_H
29
#include <limits.h>
30
#endif
46
#ifdef HAVE_LOCALE_H
31
#ifdef HAVE_LOCALE_H
47
#include <locale.h>
32
#include <locale.h>
48
#endif
33
#endif
(-)b/contrib/libarchive/tar/bsdtar.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#ifndef BSDTAR_H_INCLUDED
8
#ifndef BSDTAR_H_INCLUDED
(-)b/contrib/libarchive/tar/bsdtar_platform.h (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
Lines 115-121 Link Here
115
#define __LA_NORETURN       __attribute__((__noreturn__))
97
#define __LA_NORETURN       __attribute__((__noreturn__))
116
#elif defined(_MSC_VER)
98
#elif defined(_MSC_VER)
117
#define __LA_NORETURN __declspec(noreturn)
99
#define __LA_NORETURN __declspec(noreturn)
118
#else 
100
#else
119
#define __LA_NORETURN
101
#define __LA_NORETURN
120
#endif
102
#endif
121
103
(-)b/contrib/libarchive/tar/cmdline.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
(-)b/contrib/libarchive/tar/creation_set.c (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#include "bsdtar_platform.h"
8
#include "bsdtar_platform.h"
Lines 134-140 _cset_add_filter(struct creation_set *cset, int program, const char *filter) Link Here
134
	struct filter_set *new_ptr;
116
	struct filter_set *new_ptr;
135
	char *new_filter;
117
	char *new_filter;
136
118
137
	new_ptr = (struct filter_set *)realloc(cset->filters,
119
	new_ptr = realloc(cset->filters,
138
	    sizeof(*cset->filters) * (cset->filter_count + 1));
120
	    sizeof(*cset->filters) * (cset->filter_count + 1));
139
	if (new_ptr == NULL)
121
	if (new_ptr == NULL)
140
		lafe_errc(1, 0, "No memory");
122
		lafe_errc(1, 0, "No memory");
(-)b/contrib/libarchive/tar/read.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#include "bsdtar_platform.h"
8
#include "bsdtar_platform.h"
(-)b/contrib/libarchive/tar/subst.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2008 Joerg Sonnenberger
4
 * Copyright (c) 2008 Joerg Sonnenberger
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#include "bsdtar_platform.h"
8
#include "bsdtar_platform.h"
(-)b/contrib/libarchive/tar/test/test.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/* Every test program should #include "test.h" as the first thing. */
8
/* Every test program should #include "test.h" as the first thing. */
(-)b/contrib/libarchive/tar/test/test_0.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_basic.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_copy.c (-34 / +24 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 190-196 create_tree(void) Link Here
190
#define LIMIT_USTAR 100
172
#define LIMIT_USTAR 100
191
173
192
static void
174
static void
193
verify_tree(size_t limit)
175
verify_tree(size_t limit, const char *format)
194
{
176
{
195
	char name1[260];
177
	char name1[260];
196
	char name2[260];
178
	char name2[260];
Lines 203-208 verify_tree(size_t limit) Link Here
203
		/* Verify a file named "f/abcdef..." */
185
		/* Verify a file named "f/abcdef..." */
204
		snprintf(name1, sizeof(name1), "f/%s", filenames[i]);
186
		snprintf(name1, sizeof(name1), "f/%s", filenames[i]);
205
		if (i <= limit) {
187
		if (i <= limit) {
188
			failure("Verifying %s", format);
206
			assertFileExists(name1);
189
			assertFileExists(name1);
207
			assertFileContents(name1, (int)strlen(name1), name1);
190
			assertFileContents(name1, (int)strlen(name1), name1);
208
		}
191
		}
Lines 210-215 verify_tree(size_t limit) Link Here
210
		snprintf(name2, sizeof(name2), "l/%s", filenames[i]);
193
		snprintf(name2, sizeof(name2), "l/%s", filenames[i]);
211
		if (i + 2 <= limit) {
194
		if (i + 2 <= limit) {
212
			/* Verify hardlink "l/abcdef..." */
195
			/* Verify hardlink "l/abcdef..." */
196
			failure("Verifying %s", format);
213
			assertIsHardlink(name1, name2);
197
			assertIsHardlink(name1, name2);
214
			/* Verify hardlink "m/abcdef..." */
198
			/* Verify hardlink "m/abcdef..." */
215
			name2[0] = 'm';
199
			name2[0] = 'm';
Lines 220-232 verify_tree(size_t limit) Link Here
220
			/* Verify symlink "s/abcdef..." */
204
			/* Verify symlink "s/abcdef..." */
221
			snprintf(name1, sizeof(name1), "s/%s", filenames[i]);
205
			snprintf(name1, sizeof(name1), "s/%s", filenames[i]);
222
			snprintf(name2, sizeof(name2), "../f/%s", filenames[i]);
206
			snprintf(name2, sizeof(name2), "../f/%s", filenames[i]);
223
			if (strlen(name2) <= limit)
207
			if (strlen(name2) <= limit) {
208
				failure("Verifying %s", format);
224
				assertIsSymlink(name1, name2, 0);
209
				assertIsSymlink(name1, name2, 0);
210
			}
225
		}
211
		}
226
212
227
		/* Verify dir "d/abcdef...". */
213
		/* Verify dir "d/abcdef...". */
228
		snprintf(name1, sizeof(name1), "d/%s", filenames[i]);
214
		snprintf(name1, sizeof(name1), "d/%s", filenames[i]);
229
		if (i + 1 <= limit) { /* +1 for trailing slash */
215
		if (i + 1 <= limit) { /* +1 for trailing slash */
216
			failure("Verifying %s", format);
230
			if (assertIsDir(name1, -1)) {
217
			if (assertIsDir(name1, -1)) {
231
				/* TODO: opendir/readdir this
218
				/* TODO: opendir/readdir this
232
				 * directory and make sure
219
				 * directory and make sure
Lines 246-252 verify_tree(size_t limit) Link Here
246
			char dir[2];
233
			char dir[2];
247
			dir[0] = *dp; dir[1] = '\0';
234
			dir[0] = *dp; dir[1] = '\0';
248
			d = opendir(dir);
235
			d = opendir(dir);
249
			failure("Unable to open dir '%s'", dir);
236
			failure("Unable to open dir '%s' for testing %s", dir, format);
250
			if (!assert(d != NULL))
237
			if (!assert(d != NULL))
251
				continue;
238
				continue;
252
			while ((de = readdir(d)) != NULL) {
239
			while ((de = readdir(d)) != NULL) {
Lines 278-302 verify_tree(size_t limit) Link Here
278
}
265
}
279
266
280
static void
267
static void
281
copy_basic(void)
268
copy_basic(const char *extra_args, const char *name)
282
{
269
{
283
	int r;
270
	int r;
284
271
285
	/* NOTE: for proper operation on cygwin-1.5 and windows, the
272
	/* NOTE: for proper operation on cygwin-1.5 and windows, the
286
	 * length of the name of the directory below, "plain", must be
273
	 * length of the name of the directory below must be
287
	 * less than or equal to the length of the name of the original
274
	 * less than or equal to the length of the name of the original
288
	 * directory, "original"  This restriction derives from the
275
	 * directory, "original"  This restriction derives from the
289
	 * extremely limited pathname lengths on those platforms.
276
	 * extremely limited pathname lengths on those platforms.
290
	 */
277
	 */
291
	assertMakeDir("plain", 0775);
278
	assertMakeDir(name, 0775);
292
	assertEqualInt(0, chdir("plain"));
279
	assertEqualInt(0, chdir(name));
293
280
294
	/*
281
	/*
295
	 * Use the tar program to create an archive.
282
	 * Use the tar program to create an archive.
296
	 */
283
	 */
297
	r = systemf("%s cf archive -C ../original f d l m s >pack.out 2>pack.err",
284
	r = systemf("%s cf archive %s -C ../original f d l m s >pack.out 2>pack.err",
298
	    testprog);
285
	    testprog, extra_args);
299
	failure("Error invoking \"%s cf\"", testprog);
286
	failure("Error invoking \"%s cf archive %s\"", testprog, extra_args);
300
	assertEqualInt(r, 0);
287
	assertEqualInt(r, 0);
301
288
302
	/* Verify that nothing went to stdout or stderr. */
289
	/* Verify that nothing went to stdout or stderr. */
Lines 314-320 copy_basic(void) Link Here
314
	assertEmptyFile("unpack.err");
301
	assertEmptyFile("unpack.err");
315
	assertEmptyFile("unpack.out");
302
	assertEmptyFile("unpack.out");
316
303
317
	verify_tree(LIMIT_NONE);
304
	verify_tree(LIMIT_NONE, name);
318
	assertEqualInt(0, chdir(".."));
305
	assertEqualInt(0, chdir(".."));
319
}
306
}
320
307
Lines 357-364 copy_ustar(void) Link Here
357
	assertEmptyFile("unpack.err");
344
	assertEmptyFile("unpack.err");
358
	assertEmptyFile("unpack.out");
345
	assertEmptyFile("unpack.out");
359
346
360
	verify_tree(LIMIT_USTAR);
347
	verify_tree(LIMIT_USTAR, "ustar");
361
	assertEqualInt(0, chdir("../.."));
348
	assertEqualInt(0, chdir(".."));
362
}
349
}
363
350
364
DEFINE_TEST(test_copy)
351
DEFINE_TEST(test_copy)
Lines 367-374 DEFINE_TEST(test_copy) Link Here
367
	create_tree(); /* Create sample files in "original" dir. */
354
	create_tree(); /* Create sample files in "original" dir. */
368
355
369
	/* Test simple "tar -c | tar -x" pipeline copy. */
356
	/* Test simple "tar -c | tar -x" pipeline copy. */
370
	copy_basic();
357
	copy_basic("", "default");
371
358
372
	/* Same, but constrain to ustar format. */
359
	/* Same, but constrain to ustar format. */
373
	copy_ustar();
360
	copy_ustar();
361
362
	/* Same, but with pax format. */
363
	copy_basic(" --format pax", "pax");
374
}
364
}
(-)b/contrib/libarchive/tar/test/test_empty_mtree.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2009 Tim Kientzle
4
 * Copyright (c) 2003-2009 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_Z.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_bz2.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_grz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_gz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_lrz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_lz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_lz4.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012,2014 Michihiro NAKAJIMA
4
 * Copyright (c) 2012,2014 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_lzma.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_lzo.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_xz.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_extract_tar_zstd.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_format_newc.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_help.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_leading_slash.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2014 Tim Kientzle
4
 * Copyright (c) 2003-2014 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_missing_file.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2016 Tim Kientzle
4
 * Copyright (c) 2016 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_C_mtree.c (-24 / +6 lines)
Lines 1-29 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2018 The FreeBSD Foundation
4
 * Copyright (c) 2018 The FreeBSD Foundation
3
 * All rights reserved.
5
 * All rights reserved.
4
 * 
6
 *
5
 * This software was developed by Arshan Khanifar <arshankhanifar@gmail.com>
7
 * This software was developed by Arshan Khanifar <arshankhanifar@gmail.com>
6
 * under sponsorship from the FreeBSD Foundation.
8
 * under sponsorship from the FreeBSD Foundation.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions
10
 * are met:
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer.
13
 * 2. Redistributions in binary form must reproduce the above copyright
14
 *    notice, this list of conditions and the following disclaimer in the
15
 *    documentation and/or other materials provided with the distribution.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
9
 */
28
#include "test.h"
10
#include "test.h"
29
11
Lines 39-50 DEFINE_TEST(test_option_C_mtree) Link Here
39
	char *p;
21
	char *p;
40
#endif
22
#endif
41
23
42
	/* an absolute path to mtree file */ 
24
	/* an absolute path to mtree file */
43
	char *mtree_file = "/METALOG.mtree";	
25
	char *mtree_file = "/METALOG.mtree";
44
	char *absolute_path = malloc(strlen(testworkdir) + strlen(mtree_file) + 1);
26
	char *absolute_path = malloc(strlen(testworkdir) + strlen(mtree_file) + 1);
45
	strcpy(absolute_path, testworkdir);
27
	strcpy(absolute_path, testworkdir);
46
	strcat(absolute_path, mtree_file );
28
	strcat(absolute_path, mtree_file );
47
	
29
48
	/* Create an archive using an mtree file. */
30
	/* Create an archive using an mtree file. */
49
	assertMakeFile(absolute_path, 0777, content);
31
	assertMakeFile(absolute_path, 0777, content);
50
	assertMakeDir("bar", 0775);
32
	assertMakeDir("bar", 0775);
(-)b/contrib/libarchive/tar/test/test_option_C_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_H_upper.c (-21 / +19 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 78-84 DEFINE_TEST(test_option_H_upper) Link Here
78
	/* Test 3: With -H, some symlinks on command line. */
60
	/* Test 3: With -H, some symlinks on command line. */
79
	assertMakeDir("test3", 0755);
61
	assertMakeDir("test3", 0755);
80
	assertEqualInt(0,
62
	assertEqualInt(0,
81
	    systemf("%s -cf test3/archive.tar -H -C in ld1 d1 link2 linkY >test2/c.out 2>test2/c.err", testprog));
63
	    systemf("%s -cf test3/archive.tar -H -C in ld1 d1 link2 linkY >test3/c.out 2>test3/c.err", testprog));
82
	assertChdir("test3");
64
	assertChdir("test3");
83
	assertEqualInt(0,
65
	assertEqualInt(0,
84
	    systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
66
	    systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
Lines 88-91 DEFINE_TEST(test_option_H_upper) Link Here
88
	assertIsReg("link2", umasked(0644));
70
	assertIsReg("link2", umasked(0644));
89
	assertIsSymlink("linkY", "d1/fileY", 0);
71
	assertIsSymlink("linkY", "d1/fileY", 0);
90
	assertChdir("..");
72
	assertChdir("..");
73
74
#if defined(_WIN32) && !defined(__CYGWIN__)
75
	/* Test 4: With -H, using wildcards with some symlinks on command line. (wildcards are supported only in Windows) */
76
	assertMakeDir("test4", 0755);
77
	assertEqualInt(0,
78
	    systemf("%s -cf test4/archive.tar -H -C in * >test4/c.out 2>test4/c.err", testprog));
79
	assertChdir("test4");
80
	assertEqualInt(0,
81
	    systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
82
	assertIsDir("ld1", umasked(0755));
83
	assertIsSymlink("d1/linkX", "fileX", 0);
84
	assertIsSymlink("d1/link1", "file1", 0);
85
	assertIsReg("link2", umasked(0644));
86
	assertIsSymlink("linkY", "d1/fileY", 0);
87
	assertChdir("..");
88
#endif
91
}
89
}
(-)b/contrib/libarchive/tar/test/test_option_L_upper.c (-21 / +19 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 78-84 DEFINE_TEST(test_option_L_upper) Link Here
78
	/* Test 3: With -L, some symlinks on command line. */
60
	/* Test 3: With -L, some symlinks on command line. */
79
	assertMakeDir("test3", 0755);
61
	assertMakeDir("test3", 0755);
80
	assertEqualInt(0,
62
	assertEqualInt(0,
81
	    systemf("%s -cf test3/archive.tar -L -C in ld1 d1 link2 linkY >test2/c.out 2>test2/c.err", testprog));
63
	    systemf("%s -cf test3/archive.tar -L -C in ld1 d1 link2 linkY >test3/c.out 2>test3/c.err", testprog));
82
	assertChdir("test3");
64
	assertChdir("test3");
83
	assertEqualInt(0,
65
	assertEqualInt(0,
84
	    systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
66
	    systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
Lines 88-91 DEFINE_TEST(test_option_L_upper) Link Here
88
	assertIsReg("link2", umasked(0644));
70
	assertIsReg("link2", umasked(0644));
89
	assertIsSymlink("linkY", "d1/fileY", 0);
71
	assertIsSymlink("linkY", "d1/fileY", 0);
90
	assertChdir("..");
72
	assertChdir("..");
73
74
#if defined(_WIN32) && !defined(__CYGWIN__)
75
	/* Test 4: With -L, using wildcards with some symlinks on command line. (wildcards are supported only in Windows) */
76
	assertMakeDir("test4", 0755);
77
	assertEqualInt(0,
78
	    systemf("%s -cf test4/archive.tar -L -C in * >test4/c.out 2>test4/c.err", testprog));
79
	assertChdir("test4");
80
	assertEqualInt(0,
81
	    systemf("%s -xf archive.tar >c.out 2>c.err", testprog));
82
	assertIsDir("ld1", umasked(0755));
83
	assertIsReg("d1/link1", umasked(0644));
84
	assertIsSymlink("d1/linkX", "fileX", 0);
85
	assertIsReg("link2", umasked(0644));
86
	assertIsSymlink("linkY", "d1/fileY", 0);
87
	assertChdir("..");
88
#endif
91
}
89
}
(-)b/contrib/libarchive/tar/test/test_option_O_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_P.c (+82 lines)
Added Link Here
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
4
 * Copyright (c) 2024 Mostyn Bramley-Moore <mostyn@antipode.se>
5
 */
6
7
#include "test.h"
8
9
#include <stdlib.h>
10
#include <string.h>
11
12
#if defined(_WIN32) && !defined(__CYGWIN__)
13
#define UNLINK _unlink
14
#else
15
#define UNLINK unlink
16
#endif
17
18
DEFINE_TEST(test_extract_tar_absolute_paths)
19
{
20
	int r;
21
22
	// Create an absolute path for a test file inside testworkdir.
23
	char *entry_suffix = "/tar-noabs";
24
	size_t entry_suffix_length = strlen(entry_suffix);
25
	size_t testworkdir_length = strlen(testworkdir);
26
	size_t temp_absolute_file_name_length = testworkdir_length + entry_suffix_length;
27
	char *temp_absolute_file_name = calloc(1, temp_absolute_file_name_length + 1); // +1 for null character.
28
	assertEqualInt(snprintf(temp_absolute_file_name, temp_absolute_file_name_length + 1, "%s%s", testworkdir, entry_suffix),
29
		temp_absolute_file_name_length);
30
31
#if defined(_WIN32) && !defined(__CYGWIN__)
32
	// I'm unsure how to specify paths with spaces for the test invocation on windows.
33
	// Adding quotes doesn't seem to work. We should find a way to escape these paths,
34
	// but for now let's fail in a place that's obviously related to the test setup if
35
	// testworkdir contains spaces.
36
	for (char *p = temp_absolute_file_name; *p != '\0'; p++)
37
	{
38
		assert(*p != ' ');
39
		if (*p == ' ') break;
40
	}
41
#endif
42
43
	// Create the file.
44
	const char *sample_data = "test file from test_extract_tar_absolute_paths";
45
	assertMakeFile(temp_absolute_file_name, 0644, sample_data);
46
47
	// Create an archive with the test file, using an absolute path.
48
#if defined(_WIN32) && !defined(__CYGWIN__)
49
	r = systemf("%s --absolute-paths -cf test.tar %s", testprog, temp_absolute_file_name);
50
#else
51
	r = systemf("%s --absolute-paths -cf test.tar \"%s\"", testprog, temp_absolute_file_name);
52
#endif
53
	assertEqualInt(r, 0);
54
55
	UNLINK(temp_absolute_file_name);
56
57
	// Extracting the archive without -P / --absolute-paths should strip leading drive letter or slash
58
	r = systemf("%s -xf test.tar", testprog);
59
	assertEqualInt(r, 0);
60
	assertFileNotExists(temp_absolute_file_name);
61
62
	// Check that the mangled path exists.
63
#if defined(_WIN32) && !defined(__CYGWIN__)
64
	assertFileExists(temp_absolute_file_name + 3); // Skip the drive letter, colon and slash.
65
	UNLINK(temp_absolute_file_name + 3);
66
#else
67
	assertFileExists(temp_absolute_file_name + 1); // Skip the slash.
68
	UNLINK(temp_absolute_file_name + 1);
69
#endif
70
71
	// Extracting the archive with -P / --absolute-paths should create the file.
72
	r = systemf("%s --absolute-paths -xf test.tar", testprog);
73
	assertEqualInt(r, 0);
74
	assertFileExists(temp_absolute_file_name);
75
76
	// Check that the mangled path wasn't created.
77
#if defined(_WIN32) && !defined(__CYGWIN__)
78
	assertFileNotExists(temp_absolute_file_name + 3); // Skip the drive letter, colon and slash.
79
#else
80
	assertFileNotExists(temp_absolute_file_name + 1); // Skip the slash.
81
#endif
82
}
(-)b/contrib/libarchive/tar/test/test_option_T_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_U_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_X_upper.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_a.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_acls.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Martin Matuska
4
 * Copyright (c) 2017 Martin Matuska
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_b.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_b64encode.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_exclude.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_exclude_vcs.c (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2019 Martin Matuska
4
 * Copyright (c) 2019 Martin Matuska
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 63-69 DEFINE_TEST(test_option_exclude_vcs) Link Here
63
	assertMakeDir("_darcs", 0755);
45
	assertMakeDir("_darcs", 0755);
64
	assertMakeFile("_darcs/format", 0644, "");
46
	assertMakeFile("_darcs/format", 0644, "");
65
	assertChdir("..");
47
	assertChdir("..");
66
	
48
67
	assertEqualInt(0, systemf("%s -c -C in -f included.tar .", testprog));
49
	assertEqualInt(0, systemf("%s -c -C in -f included.tar .", testprog));
68
	assertEqualInt(0,
50
	assertEqualInt(0,
69
	    systemf("%s -c --exclude-vcs -C in -f excluded.tar .", testprog));
51
	    systemf("%s -c --exclude-vcs -C in -f excluded.tar .", testprog));
(-)b/contrib/libarchive/tar/test/test_option_fflags.c (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Martin Matuska
4
 * Copyright (c) 2017 Martin Matuska
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 97-103 DEFINE_TEST(test_option_fflags) Link Here
97
	assertMakeDir("nofflags_fflags", 0755);
79
	assertMakeDir("nofflags_fflags", 0755);
98
	clear_fflags("nofflags_fflags");
80
	clear_fflags("nofflags_fflags");
99
	r = systemf("%s -x -C nofflags_fflags --no-same-permissions --fflags -f nofflags.tar >nofflags_fflags.out 2>nofflags_fflags.err", testprog);
81
	r = systemf("%s -x -C nofflags_fflags --no-same-permissions --fflags -f nofflags.tar >nofflags_fflags.out 2>nofflags_fflags.err", testprog);
100
	assertEqualInt(r, 0);	
82
	assertEqualInt(r, 0);
101
	assertUnequalFflags("f", "nofflags_fflags/f");
83
	assertUnequalFflags("f", "nofflags_fflags/f");
102
84
103
	/* Extract nofflags with nofflags */
85
	/* Extract nofflags with nofflags */
(-)b/contrib/libarchive/tar/test/test_option_gid_gname.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2010 Tim Kientzle
4
 * Copyright (c) 2003-2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_group.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2010 Tim Kientzle
4
 * Copyright (c) 2003-2010 Tim Kientzle
3
 * Copyright (c) 2024 Haelwenn (lanodan) Monnier
5
 * Copyright (c) 2024 Haelwenn (lanodan) Monnier
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_grzip.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_ignore_zeros.c (-21 / +10 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2021 Ryan Libby
4
 * Copyright (c) 2021 Ryan Libby
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
Lines 89-94 DEFINE_TEST(test_option_ignore_zeros_mode_x) Link Here
89
70
90
DEFINE_TEST(test_option_ignore_zeros_mode_c)
71
DEFINE_TEST(test_option_ignore_zeros_mode_c)
91
{
72
{
73
#if defined(_WIN32) && !defined(__CYGWIN__)
74
	// The first command run by systemf below prints this to stderr:
75
	// bsdtar.exe: a: Can't translate uname '(null)' to UTF-8
76
	// bsdtar.exe: b: Can't translate uname '(null)' to UTF-8
77
	skipping("TODO: figure out why this test fails on github workflows with MSVC");
78
	return;
79
#endif
80
92
	if (make_files())
81
	if (make_files())
93
		return;
82
		return;
94
83
(-)b/contrib/libarchive/tar/test/test_option_j.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_k.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_keep_newer_files.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_lrzip.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_lz4.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Michihiro NAKAJIMA
4
 * Copyright (c) 2014 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_lzma.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_lzop.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_n.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_newer_than.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_nodump.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * Copyright (c) 2012 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_older_than.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2010 Tim Kientzle
4
 * Copyright (c) 2010 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_owner.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2010 Tim Kientzle
4
 * Copyright (c) 2003-2010 Tim Kientzle
3
 * Copyright (c) 2024 Haelwenn (lanodan) Monnier
5
 * Copyright (c) 2024 Haelwenn (lanodan) Monnier
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_passphrase.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2014 Michihiro NAKAJIMA
4
 * Copyright (c) 2014 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_q.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_r.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_s.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_safe_writes.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2020 Martin Matuska
4
 * Copyright (c) 2020 Martin Matuska
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_uid_uname.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2010 Tim Kientzle
4
 * Copyright (c) 2003-2010 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_option_uuencode.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_xattrs.c (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Martin Matuska
4
 * Copyright (c) 2017 Martin Matuska
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
Lines 73-79 DEFINE_TEST(test_option_xattrs) Link Here
73
	/* Extract noxattrs with xattrs */
55
	/* Extract noxattrs with xattrs */
74
	assertMakeDir("noxattrs_xattrs", 0755);
56
	assertMakeDir("noxattrs_xattrs", 0755);
75
	r = systemf("%s -x -C noxattrs_xattrs --no-same-permissions --xattrs -f noxattrs.tar >noxattrs_xattrs.out 2>noxattrs_xattrs.err", testprog);
57
	r = systemf("%s -x -C noxattrs_xattrs --no-same-permissions --xattrs -f noxattrs.tar >noxattrs_xattrs.out 2>noxattrs_xattrs.err", testprog);
76
	assertEqualInt(r, 0);	
58
	assertEqualInt(r, 0);
77
	readval = getXattr("noxattrs_xattrs/f", testattr, &size);
59
	readval = getXattr("noxattrs_xattrs/f", testattr, &size);
78
	assert(readval == NULL);
60
	assert(readval == NULL);
79
61
(-)b/contrib/libarchive/tar/test/test_option_xz.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_z.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_option_zstd.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2017 Sean Purcell
4
 * Copyright (c) 2017 Sean Purcell
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_patterns.c (-20 / +2 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2009 Michihiro NAKAJIMA
4
 * Copyright (c) 2009 Michihiro NAKAJIMA
3
 * Copyright (c) 2003-2007 Tim Kientzle
5
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
#include "test.h"
8
#include "test.h"
27
9
(-)b/contrib/libarchive/tar/test/test_print_longpath.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2011 Michihiro NAKAJIMA
4
 * Copyright (c) 2011 Michihiro NAKAJIMA
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_stdio.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_strip_components.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_symlink_dir.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/test/test_version.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/tar/util.c (-21 / +21 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#include "bsdtar_platform.h"
8
#include "bsdtar_platform.h"
Lines 234-239 yes(const char *fmt, ...) Link Here
234
	char buff[32];
216
	char buff[32];
235
	char *p;
217
	char *p;
236
	ssize_t l;
218
	ssize_t l;
219
	int read_fd = 2; /* stderr */
237
220
238
	va_list ap;
221
	va_list ap;
239
	va_start(ap, fmt);
222
	va_start(ap, fmt);
Lines 242-248 yes(const char *fmt, ...) Link Here
242
	fprintf(stderr, " (y/N)? ");
225
	fprintf(stderr, " (y/N)? ");
243
	fflush(stderr);
226
	fflush(stderr);
244
227
245
	l = read(2, buff, sizeof(buff) - 1);
228
#if defined(_WIN32) && !defined(__CYGWIN__)
229
	/* To be resilient when stdin is a pipe, bsdtar prefers to read from
230
	 * stderr.  On Windows, stderr cannot be read. The nearest "piping
231
	 * resilient" equivalent is reopening the console input handle.
232
	 */
233
	read_fd = _open("CONIN$", O_RDONLY);
234
	if (read_fd < 0) {
235
	  fprintf(stderr, "Keyboard read failed\n");
236
	  exit(1);
237
	}
238
#endif
239
240
	l = read(read_fd, buff, sizeof(buff) - 1);
241
242
#if defined(_WIN32) && !defined(__CYGWIN__)
243
	_close(read_fd);
244
#endif
245
246
	if (l < 0) {
246
	if (l < 0) {
247
	  fprintf(stderr, "Keyboard read failed\n");
247
	  fprintf(stderr, "Keyboard read failed\n");
248
	  exit(1);
248
	  exit(1);
(-)b/contrib/libarchive/tar/write.c (-25 / +10 lines)
Lines 1-27 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * Copyright (c) 2012 Michihiro NAKAJIMA
5
 * Copyright (c) 2012 Michihiro NAKAJIMA
4
 * All rights reserved.
6
 * 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:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
7
 */
26
8
27
#include "bsdtar_platform.h"
9
#include "bsdtar_platform.h"
Lines 32-38 Link Here
32
#ifdef HAVE_SYS_STAT_H
14
#ifdef HAVE_SYS_STAT_H
33
#include <sys/stat.h>
15
#include <sys/stat.h>
34
#endif
16
#endif
35
#ifdef HAVE_ATTR_XATTR_H
17
#if HAVE_SYS_XATTR_H
18
#include <sys/xattr.h>
19
#elif HAVE_ATTR_XATTR_H
36
#include <attr/xattr.h>
20
#include <attr/xattr.h>
37
#endif
21
#endif
38
#ifdef HAVE_ERRNO_H
22
#ifdef HAVE_ERRNO_H
Lines 942-948 write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) Link Here
942
926
943
		while (entry != NULL) {
927
		while (entry != NULL) {
944
			write_file(bsdtar, a, entry);
928
			write_file(bsdtar, a, entry);
945
			archive_entry_free(entry);
929
			if (entry != spare_entry) {
930
				archive_entry_free(entry);
931
			}
946
			entry = spare_entry;
932
			entry = spare_entry;
947
			spare_entry = NULL;
933
			spare_entry = NULL;
948
		}
934
		}
Lines 980-991 write_entry(struct bsdtar *bsdtar, struct archive *a, Link Here
980
			safe_fprintf(stderr, "a ");
966
			safe_fprintf(stderr, "a ");
981
			list_item_verbose(bsdtar, stderr, entry);
967
			list_item_verbose(bsdtar, stderr, entry);
982
			lafe_warnc(0, ": %s", archive_error_string(a));
968
			lafe_warnc(0, ": %s", archive_error_string(a));
983
		} else if (bsdtar->verbose > 0) {
969
		} else {
984
			lafe_warnc(0, "%s: %s",
970
			lafe_warnc(0, "%s: %s",
985
			    archive_entry_pathname(entry),
971
			    archive_entry_pathname(entry),
986
			    archive_error_string(a));
972
			    archive_error_string(a));
987
		} else
973
		}
988
			fprintf(stderr, ": %s", archive_error_string(a));
989
	}
974
	}
990
975
991
	if (e == ARCHIVE_FATAL)
976
	if (e == ARCHIVE_FATAL)
(-)b/contrib/libarchive/test_utils/test_common.h (-1 / +4 lines)
Lines 48-53 Link Here
48
#endif
48
#endif
49
49
50
#include <sys/types.h>  /* Windows requires this before sys/stat.h */
50
#include <sys/types.h>  /* Windows requires this before sys/stat.h */
51
#if !HAVE_SUSECONDS_T
52
#define suseconds_t long
53
#endif
51
#include <sys/stat.h>
54
#include <sys/stat.h>
52
55
53
#if HAVE_DIRENT_H
56
#if HAVE_DIRENT_H
Lines 313-319 int assertion_non_empty_file(const char *, int, const char *); Link Here
313
int assertion_set_nodump(const char *, int, const char *);
316
int assertion_set_nodump(const char *, int, const char *);
314
int assertion_text_file_contents(const char *, int, const char *buff, const char *f);
317
int assertion_text_file_contents(const char *, int, const char *buff, const char *f);
315
int assertion_umask(const char *, int, int);
318
int assertion_umask(const char *, int, int);
316
int assertion_utimes(const char *, int, const char *, long, long, long, long );
319
int assertion_utimes(const char *, int, const char *, time_t, suseconds_t, time_t, suseconds_t);
317
int assertion_version(const char*, int, const char *, const char *);
320
int assertion_version(const char*, int, const char *, const char *);
318
321
319
void skipping_setup(const char *, int);
322
void skipping_setup(const char *, int);
(-)b/contrib/libarchive/test_utils/test_main.c (-42 / +59 lines)
Lines 85-90 Link Here
85
#include <membership.h>
85
#include <membership.h>
86
#endif
86
#endif
87
87
88
#ifndef nitems
89
#define nitems(arr) (sizeof(arr) / sizeof((arr)[0]))
90
#endif
91
88
/*
92
/*
89
 *
93
 *
90
 * Windows support routines
94
 * Windows support routines
Lines 121-126 Link Here
121
#define access _access
125
#define access _access
122
#undef chdir
126
#undef chdir
123
#define chdir _chdir
127
#define chdir _chdir
128
#undef chmod
129
#define chmod _chmod
124
#endif
130
#endif
125
#ifndef fileno
131
#ifndef fileno
126
#define fileno _fileno
132
#define fileno _fileno
Lines 217-223 my_CreateSymbolicLinkA(const char *linkname, const char *target, Link Here
217
	static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
223
	static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
218
	DWORD attrs;
224
	DWORD attrs;
219
	static int set;
225
	static int set;
220
	int ret, tmpflags, llen, tlen;
226
	int ret, tmpflags;
227
	size_t llen, tlen;
221
	int flags = 0;
228
	int flags = 0;
222
	char *src, *tgt, *p;
229
	char *src, *tgt, *p;
223
	if (!set) {
230
	if (!set) {
Lines 233-242 my_CreateSymbolicLinkA(const char *linkname, const char *target, Link Here
233
	if (tlen == 0 || llen == 0)
240
	if (tlen == 0 || llen == 0)
234
		return (0);
241
		return (0);
235
242
236
	tgt = malloc((tlen + 1) * sizeof(char));
243
	tgt = malloc(tlen + 1);
237
	if (tgt == NULL)
244
	if (tgt == NULL)
238
		return (0);
245
		return (0);
239
	src = malloc((llen + 1) * sizeof(char));
246
	src = malloc(llen + 1);
240
	if (src == NULL) {
247
	if (src == NULL) {
241
		free(tgt);
248
		free(tgt);
242
		return (0);
249
		return (0);
Lines 1237-1252 assertion_file_contains_lines_any_order(const char *file, int line, Link Here
1237
	}
1244
	}
1238
	expected_count = i;
1245
	expected_count = i;
1239
	if (expected_count) {
1246
	if (expected_count) {
1240
		expected = malloc(sizeof(char *) * expected_count);
1247
		expected = calloc(expected_count, sizeof(*expected));
1241
		if (expected == NULL) {
1248
		if (expected == NULL) {
1242
			failure_start(pathname, line, "Can't allocate memory");
1249
			failure_start(pathname, line, "Can't allocate memory");
1243
			failure_finish(NULL);
1250
			failure_finish(NULL);
1244
			free(expected);
1251
			goto cleanup;
1245
			free(buff);
1246
			return (0);
1247
		}
1252
		}
1248
		for (i = 0; lines[i] != NULL; ++i) {
1253
		for (i = 0; lines[i] != NULL; ++i) {
1249
			expected[i] = strdup(lines[i]);
1254
			expected[i] = strdup(lines[i]);
1255
			if (expected[i] == NULL) {
1256
				failure_start(pathname, line, "Can't allocate memory");
1257
				failure_finish(NULL);
1258
				goto cleanup;
1259
			}
1250
		}
1260
		}
1251
	}
1261
	}
1252
1262
Lines 1264-1272 assertion_file_contains_lines_any_order(const char *file, int line, Link Here
1264
		if (actual == NULL) {
1274
		if (actual == NULL) {
1265
			failure_start(pathname, line, "Can't allocate memory");
1275
			failure_start(pathname, line, "Can't allocate memory");
1266
			failure_finish(NULL);
1276
			failure_finish(NULL);
1267
			free(expected);
1277
			goto cleanup;
1268
			free(buff);
1269
			return (0);
1270
		}
1278
		}
1271
		for (j = 0, p = buff; p < buff + buff_size;
1279
		for (j = 0, p = buff; p < buff + buff_size;
1272
		    p += 1 + strlen(p)) {
1280
		    p += 1 + strlen(p)) {
Lines 1279-1286 assertion_file_contains_lines_any_order(const char *file, int line, Link Here
1279
1287
1280
	/* Erase matching lines from both lists */
1288
	/* Erase matching lines from both lists */
1281
	for (i = 0; i < expected_count; ++i) {
1289
	for (i = 0; i < expected_count; ++i) {
1282
		if (expected[i] == NULL)
1283
			continue;
1284
		for (j = 0; j < actual_count; ++j) {
1290
		for (j = 0; j < actual_count; ++j) {
1285
			if (actual[j] == NULL)
1291
			if (actual[j] == NULL)
1286
				continue;
1292
				continue;
Lines 1303-1311 assertion_file_contains_lines_any_order(const char *file, int line, Link Here
1303
			++actual_failure;
1309
			++actual_failure;
1304
	}
1310
	}
1305
	if (expected_failure == 0 && actual_failure == 0) {
1311
	if (expected_failure == 0 && actual_failure == 0) {
1306
		free(buff);
1307
		free(expected);
1308
		free(actual);
1312
		free(actual);
1313
		free(expected);
1314
		free(buff);
1309
		return (1);
1315
		return (1);
1310
	}
1316
	}
1311
	failure_start(file, line, "File doesn't match: %s", pathname);
1317
	failure_start(file, line, "File doesn't match: %s", pathname);
Lines 1313-1318 assertion_file_contains_lines_any_order(const char *file, int line, Link Here
1313
		if (expected[i] != NULL) {
1319
		if (expected[i] != NULL) {
1314
			logprintf("  Expected but not present: %s\n", expected[i]);
1320
			logprintf("  Expected but not present: %s\n", expected[i]);
1315
			free(expected[i]);
1321
			free(expected[i]);
1322
			expected[i] = NULL;
1316
		}
1323
		}
1317
	}
1324
	}
1318
	for (j = 0; j < actual_count; ++j) {
1325
	for (j = 0; j < actual_count; ++j) {
Lines 1320-1328 assertion_file_contains_lines_any_order(const char *file, int line, Link Here
1320
			logprintf("  Present but not expected: %s\n", actual[j]);
1327
			logprintf("  Present but not expected: %s\n", actual[j]);
1321
	}
1328
	}
1322
	failure_finish(NULL);
1329
	failure_finish(NULL);
1323
	free(buff);
1330
cleanup:
1324
	free(expected);
1325
	free(actual);
1331
	free(actual);
1332
	if (expected != NULL) {
1333
		for (i = 0; i < expected_count; ++i)
1334
			if (expected[i] != NULL)
1335
				free(expected[i]);
1336
		free(expected);
1337
	}
1338
	free(buff);
1326
	return (0);
1339
	return (0);
1327
}
1340
}
1328
1341
Lines 1766-1781 is_symlink(const char *file, int line, Link Here
1766
	    FILE_FLAG_OPEN_REPARSE_POINT;
1779
	    FILE_FLAG_OPEN_REPARSE_POINT;
1767
1780
1768
	/* Replace slashes with backslashes in pathname */
1781
	/* Replace slashes with backslashes in pathname */
1769
	pn = malloc((strlen(pathname) + 1) * sizeof(char));
1782
	pn = malloc(strlen(pathname) + 1);
1770
	p = pathname;
1783
	if (pn == NULL) {
1771
	s = pn;
1784
		failure_start(file, line, "Can't allocate memory");
1772
	while(*p != '\0') {
1785
		failure_finish(NULL);
1773
		if(*p == '/')
1786
		return (0);
1787
	}
1788
	for (p = pathname, s = pn; *p != '\0'; p++, s++) {
1789
		if (*p == '/')
1774
			*s = '\\';
1790
			*s = '\\';
1775
		else
1791
		else
1776
			*s = *p;
1792
			*s = *p;
1777
		p++;
1778
		s++;
1779
	}
1793
	}
1780
	*s = '\0';
1794
	*s = '\0';
1781
1795
Lines 2083-2090 assertion_umask(const char *file, int line, int mask) Link Here
2083
2097
2084
/* Set times, report failures. */
2098
/* Set times, report failures. */
2085
int
2099
int
2086
assertion_utimes(const char *file, int line,
2100
assertion_utimes(const char *file, int line, const char *pathname,
2087
    const char *pathname, long at, long at_nsec, long mt, long mt_nsec)
2101
    time_t at, suseconds_t at_nsec, time_t mt, suseconds_t mt_nsec)
2088
{
2102
{
2089
	int r;
2103
	int r;
2090
2104
Lines 2950-2956 setTestAcl(const char *path) Link Here
2950
	acl_permset_t permset;
2964
	acl_permset_t permset;
2951
	const uid_t uid = 1;
2965
	const uid_t uid = 1;
2952
	uuid_t uuid;
2966
	uuid_t uuid;
2953
	int i;
2954
	const acl_perm_t acl_perms[] = {
2967
	const acl_perm_t acl_perms[] = {
2955
		ACL_READ_DATA,
2968
		ACL_READ_DATA,
2956
		ACL_WRITE_DATA,
2969
		ACL_WRITE_DATA,
Lines 2992-2998 setTestAcl(const char *path) Link Here
2992
	failure("acl_get_permset() error: %s", strerror(errno));
3005
	failure("acl_get_permset() error: %s", strerror(errno));
2993
	if (assertEqualInt(r, 0) == 0)
3006
	if (assertEqualInt(r, 0) == 0)
2994
		goto testacl_free;
3007
		goto testacl_free;
2995
	for (i = 0; i < (int)(sizeof(acl_perms) / sizeof(acl_perms[0])); i++) {
3008
	for (size_t i = 0; i < nitems(acl_perms); i++) {
2996
		r = acl_add_perm(permset, acl_perms[i]);
3009
		r = acl_add_perm(permset, acl_perms[i]);
2997
		failure("acl_add_perm() error: %s", strerror(errno));
3010
		failure("acl_add_perm() error: %s", strerror(errno));
2998
		if (assertEqualInt(r, 0) == 0)
3011
		if (assertEqualInt(r, 0) == 0)
Lines 3642-3648 test_run(int i, const char *tmpdir) Link Here
3642
static void
3655
static void
3643
usage(const char *program)
3656
usage(const char *program)
3644
{
3657
{
3645
	static const int limit = sizeof(tests) / sizeof(tests[0]);
3658
	static const int limit = nitems(tests);
3646
	int i;
3659
	int i;
3647
3660
3648
	printf("Usage: %s [options] <test> <test> ...\n", program);
3661
	printf("Usage: %s [options] <test> <test> ...\n", program);
Lines 3874-3885 get_test_set(int *test_set, int limit, const char *test) Link Here
3874
int
3887
int
3875
main(int argc, char **argv)
3888
main(int argc, char **argv)
3876
{
3889
{
3877
	static const int limit = sizeof(tests) / sizeof(tests[0]);
3890
	static const int limit = nitems(tests);
3878
	int test_set[sizeof(tests) / sizeof(tests[0])];
3891
	int test_set[nitems(tests)];
3879
	int i = 0, j = 0, tests_run = 0, tests_failed = 0, option;
3892
	int i = 0, j = 0, tests_run = 0, tests_failed = 0, option;
3880
	int testprogdir_len;
3893
	size_t testprogdir_len;
3894
	size_t tmplen;
3881
#ifdef PROGRAM
3895
#ifdef PROGRAM
3882
	int tmp2_len;
3896
	size_t tmp2_len;
3883
#endif
3897
#endif
3884
	time_t now;
3898
	time_t now;
3885
	struct tm *tmptr;
3899
	struct tm *tmptr;
Lines 3922-3928 main(int argc, char **argv) Link Here
3922
	 */
3936
	 */
3923
	progname = p = argv[0];
3937
	progname = p = argv[0];
3924
	testprogdir_len = strlen(progname) + 1;
3938
	testprogdir_len = strlen(progname) + 1;
3925
	if ((testprogdir = (char *)malloc(testprogdir_len)) == NULL)
3939
	if ((testprogdir = malloc(testprogdir_len)) == NULL)
3926
	{
3940
	{
3927
		fprintf(stderr, "ERROR: Out of memory.");
3941
		fprintf(stderr, "ERROR: Out of memory.");
3928
		exit(1);
3942
		exit(1);
Lines 3950-3956 main(int argc, char **argv) Link Here
3950
#endif
3964
#endif
3951
	{
3965
	{
3952
		/* Fixup path for relative directories. */
3966
		/* Fixup path for relative directories. */
3953
		if ((testprogdir = (char *)realloc(testprogdir,
3967
		if ((testprogdir = realloc(testprogdir,
3954
			strlen(pwd) + 1 + strlen(testprogdir) + 1)) == NULL)
3968
			strlen(pwd) + 1 + strlen(testprogdir) + 1)) == NULL)
3955
		{
3969
		{
3956
			fprintf(stderr, "ERROR: Out of memory.");
3970
			fprintf(stderr, "ERROR: Out of memory.");
Lines 3977-3982 main(int argc, char **argv) Link Here
3977
		tmp = getenv("TEMPDIR");
3991
		tmp = getenv("TEMPDIR");
3978
	else
3992
	else
3979
		tmp = "/tmp";
3993
		tmp = "/tmp";
3994
	tmplen = strlen(tmp);
3995
	while (tmplen > 0 && tmp[tmplen - 1] == '/')
3996
		tmplen--;
3980
3997
3981
	/* Allow -d to be controlled through the environment. */
3998
	/* Allow -d to be controlled through the environment. */
3982
	if (getenv(ENVBASE "_DEBUG") != NULL)
3999
	if (getenv(ENVBASE "_DEBUG") != NULL)
Lines 4070-4076 main(int argc, char **argv) Link Here
4070
	if (testprogfile == NULL)
4087
	if (testprogfile == NULL)
4071
	{
4088
	{
4072
		tmp2_len = strlen(testprogdir) + 1 + strlen(PROGRAM) + 1;
4089
		tmp2_len = strlen(testprogdir) + 1 + strlen(PROGRAM) + 1;
4073
		if ((tmp2 = (char *)malloc(tmp2_len)) == NULL)
4090
		if ((tmp2 = malloc(tmp2_len)) == NULL)
4074
		{
4091
		{
4075
			fprintf(stderr, "ERROR: Out of memory.");
4092
			fprintf(stderr, "ERROR: Out of memory.");
4076
			exit(1);
4093
			exit(1);
Lines 4083-4089 main(int argc, char **argv) Link Here
4083
4100
4084
	{
4101
	{
4085
		char *testprg;
4102
		char *testprg;
4086
		int testprg_len;
4103
		size_t testprg_len;
4087
#if defined(_WIN32) && !defined(__CYGWIN__)
4104
#if defined(_WIN32) && !defined(__CYGWIN__)
4088
		/* Command.com sometimes rejects '/' separators. */
4105
		/* Command.com sometimes rejects '/' separators. */
4089
		testprg = strdup(testprogfile);
4106
		testprg = strdup(testprogfile);
Lines 4129-4144 main(int argc, char **argv) Link Here
4129
#endif
4146
#endif
4130
		strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
4147
		strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
4131
		    "%Y-%m-%dT%H.%M.%S", tmptr);
4148
		    "%Y-%m-%dT%H.%M.%S", tmptr);
4132
		if ((strlen(tmp) + 1 + strlen(progname) + 1 +
4149
		if (tmplen + 1 + strlen(progname) + 1 +
4133
		    strlen(tmpdir_timestamp) + 1 + 3) >
4150
		    strlen(tmpdir_timestamp) + 1 + 3 >=
4134
		    (sizeof(tmpdir) / sizeof(char))) {
4151
		    nitems(tmpdir)) {
4135
			fprintf(stderr,
4152
			fprintf(stderr,
4136
			    "ERROR: Temp directory pathname too long\n");
4153
			    "ERROR: Temp directory pathname too long\n");
4137
			exit(1);
4154
			exit(1);
4138
		}
4155
		}
4139
		snprintf(tmpdir, sizeof(tmpdir), "%s/%s.%s-%03d", tmp,
4156
		snprintf(tmpdir, sizeof(tmpdir), "%.*s/%s.%s-%03d",
4140
		    progname, tmpdir_timestamp, i);
4157
		    (int)tmplen, tmp, progname, tmpdir_timestamp, i);
4141
		if (assertMakeDir(tmpdir,0755))
4158
		if (assertMakeDir(tmpdir, 0755))
4142
			break;
4159
			break;
4143
		if (i >= 999) {
4160
		if (i >= 999) {
4144
			fprintf(stderr,
4161
			fprintf(stderr,
(-)b/contrib/libarchive/unzip/bsdunzip.1 (-22 / +3 lines)
Lines 1-28 Link Here
1
.\"-
1
.\"-
2
.\" SPDX-License-Identifier: BSD-2-Clause
3
.\"
2
.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
4
.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
3
.\" All rights reserved.
5
.\" All rights reserved.
4
.\"
6
.\"
5
.\" Redistribution and use in source and binary forms, with or without
6
.\" modification, are permitted provided that the following conditions
7
.\" are met:
8
.\" 1. Redistributions of source code must retain the above copyright
9
.\"    notice, this list of conditions and the following disclaimer.
10
.\" 2. Redistributions in binary form must reproduce the above copyright
11
.\"    notice, this list of conditions and the following disclaimer in the
12
.\"    documentation and/or other materials provided with the distribution.
13
.\"
14
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
.\" SUCH DAMAGE.
25
.\"
26
.Dd June 27, 2023
7
.Dd June 27, 2023
27
.Dt BSDUNZIP 1
8
.Dt BSDUNZIP 1
28
.Os
9
.Os
Lines 215-218 double-dash string used to separate options from arguments will need to Link Here
215
be repeated.
196
be repeated.
216
For example, to extract a "-a.jpg" from "-b.zip" with overwrite, one
197
For example, to extract a "-a.jpg" from "-b.zip" with overwrite, one
217
would need to invoke
198
would need to invoke
218
.Dl bsdunzip -o -- -a.jpg -- -b.zip 
199
.Dl bsdunzip -o -- -a.jpg -- -b.zip
(-)b/contrib/libarchive/unzip/bsdunzip.c (-39 / +10 lines)
Lines 4-46 Link Here
4
 * Copyright (c) 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
4
 * Copyright (c) 2009, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
5
 * Copyright (c) 2007-2008 Dag-Erling Smørgrav
5
 * Copyright (c) 2007-2008 Dag-Erling Smørgrav
6
 * All rights reserved.
6
 * All rights reserved.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions
10
 * are met:
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer
13
 *    in this position and unchanged.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28
 * SUCH DAMAGE.
29
 *
30
 * This file would be much shorter if we didn't care about command-line
31
 * compatibility with Info-ZIP's UnZip, which requires us to duplicate
32
 * parts of libarchive in order to gain more detailed control of its
33
 * behaviour for the purpose of implementing the -n, -o, -L and -a
34
 * options.
35
 */
7
 */
36
8
37
#include "bsdunzip_platform.h"
9
#include "bsdunzip_platform.h"
38
10
39
#ifdef HAVE_SYS_QUEUE_H
40
#include <sys/queue.h>
41
#else
42
#include "la_queue.h"
11
#include "la_queue.h"
43
#endif
44
#ifdef HAVE_SYS_STAT_H
12
#ifdef HAVE_SYS_STAT_H
45
#include <sys/stat.h>
13
#include <sys/stat.h>
46
#endif
14
#endif
Lines 484-496 handle_existing_file(char **path) Link Here
484
		fprintf(stderr,
452
		fprintf(stderr,
485
		    "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ",
453
		    "replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ",
486
		    *path);
454
		    *path);
487
		if (fgets(buf, sizeof(buf), stdin) == NULL) {
455
		if (fgets(buf, sizeof(buf), stdin) == NULL)
488
			clearerr(stdin);
456
			goto stdin_err;
489
			printf("NULL\n(EOF or read error, "
490
			    "treating as \"[N]one\"...)\n");
491
			n_opt = 1;
492
			return -1;
493
		}
494
		switch (*buf) {
457
		switch (*buf) {
495
		case 'A':
458
		case 'A':
496
			o_opt = 1;
459
			o_opt = 1;
Lines 512-517 handle_existing_file(char **path) Link Here
512
			*path = NULL;
475
			*path = NULL;
513
			alen = 0;
476
			alen = 0;
514
			len = getline(path, &alen, stdin);
477
			len = getline(path, &alen, stdin);
478
			if (len < 1)
479
				goto stdin_err;
515
			if ((*path)[len - 1] == '\n')
480
			if ((*path)[len - 1] == '\n')
516
				(*path)[len - 1] = '\0';
481
				(*path)[len - 1] = '\0';
517
			return 0;
482
			return 0;
Lines 519-524 handle_existing_file(char **path) Link Here
519
			break;
484
			break;
520
		}
485
		}
521
	}
486
	}
487
stdin_err:
488
	clearerr(stdin);
489
	printf("NULL\n(EOF or read error, "
490
		"treating as \"[N]one\"...)\n");
491
	n_opt = 1;
492
	return -1;
522
}
493
}
523
494
524
/*
495
/*
(-)b/contrib/libarchive/unzip/bsdunzip.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023, Martin Matuska
4
 * Copyright (c) 2023, Martin Matuska
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
#ifndef BSDUNZIP_H_INCLUDED
8
#ifndef BSDUNZIP_H_INCLUDED
(-)b/contrib/libarchive/unzip/bsdunzip_platform.h (-21 / +3 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
Lines 58-64 Link Here
58
#define __LA_NORETURN       __attribute__((__noreturn__))
40
#define __LA_NORETURN       __attribute__((__noreturn__))
59
#elif defined(_MSC_VER)
41
#elif defined(_MSC_VER)
60
#define __LA_NORETURN __declspec(noreturn)
42
#define __LA_NORETURN __declspec(noreturn)
61
#else 
43
#else
62
#define __LA_NORETURN
44
#define __LA_NORETURN
63
#endif
45
#endif
64
46
(-)b/contrib/libarchive/unzip/cmdline.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2008 Tim Kientzle
4
 * Copyright (c) 2003-2008 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/*
8
/*
(-)b/contrib/libarchive/unzip/la_getline.c (-24 / +2 lines)
Lines 1-32 Link Here
1
/*	$NetBSD: getline.c,v 1.2 2014/09/16 17:23:50 christos Exp $	*/
1
/*	$NetBSD: getline.c,v 1.2 2014/09/16 17:23:50 christos Exp $	*/
2
2
3
/*-
3
/*-
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 *
4
 * Copyright (c) 2011 The NetBSD Foundation, Inc.
6
 * Copyright (c) 2011 The NetBSD Foundation, Inc.
5
 * All rights reserved.
7
 * All rights reserved.
6
 *
7
 * This code is derived from software contributed to The NetBSD Foundation
8
 * by Christos Zoulas.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
 * POSSIBILITY OF SUCH DAMAGE.
30
 */
8
 */
31
9
32
#include "bsdunzip_platform.h"
10
#include "bsdunzip_platform.h"
(-)b/contrib/libarchive/unzip/test/test.h (-20 / +2 lines)
Lines 1-26 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
7
26
/* Every test program should #include "test.h" as the first thing. */
8
/* Every test program should #include "test.h" as the first thing. */
(-)b/contrib/libarchive/unzip/test/test_0.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2007 Tim Kientzle
4
 * Copyright (c) 2003-2007 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/unzip/test/test_C.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_I.c (-30 / +10 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Aaron Lindros
4
 * Copyright (c) 2023 Aaron Lindros
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
Lines 33-39 Link Here
33
DEFINE_TEST(test_I)
14
DEFINE_TEST(test_I)
34
{
15
{
35
	const char *reffile = "test_I.zip";
16
	const char *reffile = "test_I.zip";
36
	const char *lang;
17
#if !defined(_WIN32) || defined(__CYGWIN__)
18
	const char *envstr = "env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 "
19
	    "LC_CTYPE=en_US.UTF-8";
20
#else
21
	const char *envstr = "";
22
#endif
37
	int r;
23
	int r;
38
24
39
#if HAVE_SETLOCALE
25
#if HAVE_SETLOCALE
Lines 45-62 DEFINE_TEST(test_I) Link Here
45
	skipping("setlocale() not available on this system.");
31
	skipping("setlocale() not available on this system.");
46
#endif
32
#endif
47
33
48
	lang = getenv("LANG");
49
	setenv("LANG", "en_US.UTF-8", 1);
50
	extract_reference_file(reffile);
34
	extract_reference_file(reffile);
51
	r = systemf("%s -I UTF-8 %s >test.out 2>test.err", testprog, reffile);
35
	r = systemf("%s %s -I UTF-8 %s >test.out 2>test.err", envstr, testprog,
36
	    reffile);
52
	assertEqualInt(0, r);
37
	assertEqualInt(0, r);
53
	assertNonEmptyFile("test.out");
38
	assertNonEmptyFile("test.out");
54
	assertEmptyFile("test.err");
39
	assertEmptyFile("test.err");
55
40
56
	assertTextFileContents("Hello, World!\n", "Γειά σου Κόσμε.txt");
41
	assertTextFileContents("Hello, World!\n", "Γειά σου Κόσμε.txt");
57
58
	if (lang == NULL)
59
		unsetenv("LANG");
60
	else
61
		setenv("LANG", lang, 1);
62
}
42
}
(-)b/contrib/libarchive/unzip/test/test_L.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_P_encryption.c (-22 / +3 lines)
Lines 1-32 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
28
/* Test P arg - password protected */
9
/* Test P arg - password protected */
29
DEFINE_TEST(test_P)
10
DEFINE_TEST(test_P_encryption)
30
{
11
{
31
	const char *reffile = "test_encrypted.zip";
12
	const char *reffile = "test_encrypted.zip";
32
	int r;
13
	int r;
(-)b/contrib/libarchive/unzip/test/test_Z1.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_basic.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_d.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_doubledash.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_glob.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_j.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_n.c (-22 / +3 lines)
Lines 1-31 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
28
/* Test n arg - don't overrite existing files */
9
/* Test n arg - don't overwrite existing files */
29
DEFINE_TEST(test_n)
10
DEFINE_TEST(test_n)
30
{
11
{
31
	const char *reffile = "test_basic.zip";
12
	const char *reffile = "test_basic.zip";
(-)b/contrib/libarchive/unzip/test/test_not_exist.c (-22 / +3 lines)
Lines 1-31 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
28
/* Test non existant file */
9
/* Test non existent file */
29
DEFINE_TEST(test_not_exist)
10
DEFINE_TEST(test_not_exist)
30
{
11
{
31
	int r;
12
	int r;
(-)b/contrib/libarchive/unzip/test/test_o.c (-22 / +3 lines)
Lines 1-31 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
28
/* Test o arg - overrite existing files */
9
/* Test o arg - overwrite existing files */
29
DEFINE_TEST(test_o)
10
DEFINE_TEST(test_o)
30
{
11
{
31
	const char *reffile = "test_basic.zip";
12
	const char *reffile = "test_basic.zip";
(-)b/contrib/libarchive/unzip/test/test_p.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_q.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_singlefile.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_t.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_t_bad.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/contrib/libarchive/unzip/test/test_version.c (-20 / +2 lines)
Lines 1-26 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2003-2017 Tim Kientzle
4
 * Copyright (c) 2003-2017 Tim Kientzle
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
6
 */
25
#include "test.h"
7
#include "test.h"
26
8
(-)b/contrib/libarchive/unzip/test/test_x.c (-21 / +2 lines)
Lines 1-27 Link Here
1
/*
1
/*
2
 * SPDX-License-Identifier: BSD-2-Clause
3
 *
2
 * Copyright (c) 2023 Adrian Vovk
4
 * Copyright (c) 2023 Adrian Vovk
3
 * All rights reserved.
5
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer
10
 *    in this position and unchanged.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
6
 */
26
#include "test.h"
7
#include "test.h"
27
8
(-)b/lib/libarchive/tests/Makefile (+24 lines)
Lines 26-37 CFLAGS.test_utils.c+= -Wno-cast-align Link Here
26
26
27
.PATH: ${_LIBARCHIVEDIR}/libarchive/test
27
.PATH: ${_LIBARCHIVEDIR}/libarchive/test
28
TESTS_SRCS= \
28
TESTS_SRCS= \
29
	test_7zip_filename_encoding.c		\
29
	test_acl_nfs4.c				\
30
	test_acl_nfs4.c				\
30
	test_acl_pax.c				\
31
	test_acl_pax.c				\
31
	test_acl_platform_nfs4.c		\
32
	test_acl_platform_nfs4.c		\
32
	test_acl_platform_posix1e.c		\
33
	test_acl_platform_posix1e.c		\
33
	test_acl_posix1e.c			\
34
	test_acl_posix1e.c			\
34
	test_acl_text.c				\
35
	test_acl_text.c				\
36
	test_ar_mode.c				\
35
	test_archive_api_feature.c		\
37
	test_archive_api_feature.c		\
36
	test_archive_clear_error.c		\
38
	test_archive_clear_error.c		\
37
	test_archive_cmdline.c			\
39
	test_archive_cmdline.c			\
Lines 41-46 TESTS_SRCS= \ Link Here
41
	test_archive_match_owner.c		\
43
	test_archive_match_owner.c		\
42
	test_archive_match_path.c		\
44
	test_archive_match_path.c		\
43
	test_archive_pathmatch.c		\
45
	test_archive_pathmatch.c		\
46
	test_archive_read.c			\
44
	test_archive_read_add_passphrase.c	\
47
	test_archive_read_add_passphrase.c	\
45
	test_archive_read_close_twice.c		\
48
	test_archive_read_close_twice.c		\
46
	test_archive_read_close_twice_open_fd.c	\
49
	test_archive_read_close_twice_open_fd.c	\
Lines 108-113 TESTS_SRCS= \ Link Here
108
	test_read_file_nonexistent.c		\
111
	test_read_file_nonexistent.c		\
109
	test_read_filter_compress.c		\
112
	test_read_filter_compress.c		\
110
	test_read_filter_grzip.c		\
113
	test_read_filter_grzip.c		\
114
	test_read_filter_gzip_recursive.c	\
111
	test_read_filter_lrzip.c		\
115
	test_read_filter_lrzip.c		\
112
	test_read_filter_lzop.c			\
116
	test_read_filter_lzop.c			\
113
	test_read_filter_lzop_multiple_parts.c	\
117
	test_read_filter_lzop_multiple_parts.c	\
Lines 146-151 TESTS_SRCS= \ Link Here
146
	test_read_format_gtar_lzma.c		\
150
	test_read_format_gtar_lzma.c		\
147
	test_read_format_gtar_sparse.c		\
151
	test_read_format_gtar_sparse.c		\
148
	test_read_format_gtar_sparse_skip_entry.c \
152
	test_read_format_gtar_sparse_skip_entry.c \
153
	test_read_format_huge_rpm.c		\
149
	test_read_format_iso_Z.c		\
154
	test_read_format_iso_Z.c		\
150
	test_read_format_iso_multi_extent.c	\
155
	test_read_format_iso_multi_extent.c	\
151
	test_read_format_iso_xorriso.c		\
156
	test_read_format_iso_xorriso.c		\
Lines 167-172 TESTS_SRCS= \ Link Here
167
	test_read_format_pax_bz2.c		\
172
	test_read_format_pax_bz2.c		\
168
	test_read_format_rar.c			\
173
	test_read_format_rar.c			\
169
	test_read_format_rar5.c			\
174
	test_read_format_rar5.c			\
175
	test_read_format_rar_encryption.c	\
170
	test_read_format_rar_encryption_data.c	\
176
	test_read_format_rar_encryption_data.c	\
171
	test_read_format_rar_encryption_header.c	\
177
	test_read_format_rar_encryption_header.c	\
172
	test_read_format_rar_encryption_partially.c	\
178
	test_read_format_rar_encryption_partially.c	\
Lines 180-185 TESTS_SRCS= \ Link Here
180
	test_read_format_tar_empty_with_gnulabel.c	\
186
	test_read_format_tar_empty_with_gnulabel.c	\
181
	test_read_format_tar_filename.c		\
187
	test_read_format_tar_filename.c		\
182
	test_read_format_tar_invalid_pax_size.c \
188
	test_read_format_tar_invalid_pax_size.c \
189
	test_read_format_tar_pax_large_attr.c	\
183
	test_read_format_tbz.c			\
190
	test_read_format_tbz.c			\
184
	test_read_format_tgz.c			\
191
	test_read_format_tgz.c			\
185
	test_read_format_tlz.c			\
192
	test_read_format_tlz.c			\
Lines 238-243 TESTS_SRCS= \ Link Here
238
	test_write_disk_no_hfs_compression.c	\
245
	test_write_disk_no_hfs_compression.c	\
239
	test_write_disk_perms.c			\
246
	test_write_disk_perms.c			\
240
	test_write_disk_secure.c		\
247
	test_write_disk_secure.c		\
248
	test_write_disk_secure_noabsolutepaths.c	\
241
	test_write_disk_secure744.c		\
249
	test_write_disk_secure744.c		\
242
	test_write_disk_secure745.c		\
250
	test_write_disk_secure745.c		\
243
	test_write_disk_secure746.c		\
251
	test_write_disk_secure746.c		\
Lines 304-309 TESTS_SRCS= \ Link Here
304
	test_write_format_zip_zip64.c		\
312
	test_write_format_zip_zip64.c		\
305
	test_write_format_zip64_stream.c	\
313
	test_write_format_zip64_stream.c	\
306
	test_write_format_zip_stream.c		\
314
	test_write_format_zip_stream.c		\
315
	test_write_format_zip_windows_path.c	\
307
	test_write_open_memory.c		\
316
	test_write_open_memory.c		\
308
	test_write_read_format_zip.c		\
317
	test_write_read_format_zip.c		\
309
	test_xattr_platform.c			\
318
	test_xattr_platform.c			\
Lines 429-434 ${PACKAGE}FILES+= test_rar_multivolume_uncompressed_files.part08.rar.uu Link Here
429
${PACKAGE}FILES+=	test_rar_multivolume_uncompressed_files.part09.rar.uu
438
${PACKAGE}FILES+=	test_rar_multivolume_uncompressed_files.part09.rar.uu
430
${PACKAGE}FILES+=	test_rar_multivolume_uncompressed_files.part10.rar.uu
439
${PACKAGE}FILES+=	test_rar_multivolume_uncompressed_files.part10.rar.uu
431
${PACKAGE}FILES+=	test_read_filter_grzip.tar.grz.uu
440
${PACKAGE}FILES+=	test_read_filter_grzip.tar.grz.uu
441
${PACKAGE}FILES+=	test_read_filter_gzip_recursive.gz.uu
432
${PACKAGE}FILES+=	test_read_filter_lrzip.tar.lrz.uu
442
${PACKAGE}FILES+=	test_read_filter_lrzip.tar.lrz.uu
433
${PACKAGE}FILES+=	test_read_filter_lzop.tar.lzo.uu
443
${PACKAGE}FILES+=	test_read_filter_lzop.tar.lzo.uu
434
${PACKAGE}FILES+=	test_read_filter_lzop_multiple_parts.tar.lzo.uu
444
${PACKAGE}FILES+=	test_read_filter_lzop_multiple_parts.tar.lzo.uu
Lines 462-467 ${PACKAGE}FILES+= test_read_format_7zip_empty_file.7z.uu Link Here
462
${PACKAGE}FILES+=	test_read_format_7zip_encryption.7z.uu
472
${PACKAGE}FILES+=	test_read_format_7zip_encryption.7z.uu
463
${PACKAGE}FILES+=	test_read_format_7zip_encryption_header.7z.uu
473
${PACKAGE}FILES+=	test_read_format_7zip_encryption_header.7z.uu
464
${PACKAGE}FILES+=	test_read_format_7zip_encryption_partially.7z.uu
474
${PACKAGE}FILES+=	test_read_format_7zip_encryption_partially.7z.uu
475
${PACKAGE}FILES+=	test_read_format_7zip_extract_second.7z.uu
465
${PACKAGE}FILES+=	test_read_format_7zip_lzma1.7z.uu
476
${PACKAGE}FILES+=	test_read_format_7zip_lzma1.7z.uu
466
${PACKAGE}FILES+=	test_read_format_7zip_lzma1_2.7z.uu
477
${PACKAGE}FILES+=	test_read_format_7zip_lzma1_2.7z.uu
467
${PACKAGE}FILES+=	test_read_format_7zip_lzma1_lzma2.7z.uu
478
${PACKAGE}FILES+=	test_read_format_7zip_lzma1_lzma2.7z.uu
Lines 503-510 ${PACKAGE}FILES+= test_read_format_gtar_sparse_1_17_posix01.tar.uu Link Here
503
${PACKAGE}FILES+=	test_read_format_gtar_sparse_1_17_posix10.tar.uu
514
${PACKAGE}FILES+=	test_read_format_gtar_sparse_1_17_posix10.tar.uu
504
${PACKAGE}FILES+=	test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
515
${PACKAGE}FILES+=	test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
505
${PACKAGE}FILES+=	test_read_format_gtar_sparse_skip_entry.tar.Z.uu
516
${PACKAGE}FILES+=	test_read_format_gtar_sparse_skip_entry.tar.Z.uu
517
${PACKAGE}FILES+=	test_read_format_huge_rpm.rpm.uu
506
${PACKAGE}FILES+=	test_read_format_iso.iso.Z.uu
518
${PACKAGE}FILES+=	test_read_format_iso.iso.Z.uu
507
${PACKAGE}FILES+=	test_read_format_iso_2.iso.Z.uu
519
${PACKAGE}FILES+=	test_read_format_iso_2.iso.Z.uu
520
${PACKAGE}FILES+=	test_read_format_iso_3.iso.Z.uu
508
${PACKAGE}FILES+=	test_read_format_iso_joliet.iso.Z.uu
521
${PACKAGE}FILES+=	test_read_format_iso_joliet.iso.Z.uu
509
${PACKAGE}FILES+=	test_read_format_iso_joliet_by_nero.iso.Z.uu
522
${PACKAGE}FILES+=	test_read_format_iso_joliet_by_nero.iso.Z.uu
510
${PACKAGE}FILES+=	test_read_format_iso_joliet_long.iso.Z.uu
523
${PACKAGE}FILES+=	test_read_format_iso_joliet_long.iso.Z.uu
Lines 555-563 ${PACKAGE}FILES+= test_read_format_rar_sfx.exe.uu Link Here
555
${PACKAGE}FILES+=	test_read_format_rar_subblock.rar.uu
568
${PACKAGE}FILES+=	test_read_format_rar_subblock.rar.uu
556
${PACKAGE}FILES+=	test_read_format_rar_unicode.rar.uu
569
${PACKAGE}FILES+=	test_read_format_rar_unicode.rar.uu
557
${PACKAGE}FILES+=	test_read_format_rar_windows.rar.uu
570
${PACKAGE}FILES+=	test_read_format_rar_windows.rar.uu
571
${PACKAGE}FILES+=	test_read_format_rar4_encrypted.rar.uu
572
${PACKAGE}FILES+=	test_read_format_rar4_encrypted_filenames.rar.uu
573
${PACKAGE}FILES+=	test_read_format_rar4_solid_encrypted.rar.uu
574
${PACKAGE}FILES+=	test_read_format_rar4_solid_encrypted_filenames.rar.uu
558
${PACKAGE}FILES+=	test_read_format_rar5_arm.rar.uu
575
${PACKAGE}FILES+=	test_read_format_rar5_arm.rar.uu
559
${PACKAGE}FILES+=	test_read_format_rar5_arm_filter_on_window_boundary.rar.uu
576
${PACKAGE}FILES+=	test_read_format_rar5_arm_filter_on_window_boundary.rar.uu
560
${PACKAGE}FILES+=	test_read_format_rar5_bad_window_sz_in_mltarc_file.rar.uu
577
${PACKAGE}FILES+=	test_read_format_rar5_bad_window_sz_in_mltarc_file.rar.uu
578
${PACKAGE}FILES+=	test_read_format_rar5_data_ready_pointer_leak.rar.uu
561
${PACKAGE}FILES+=	test_read_format_rar5_blake2.rar.uu
579
${PACKAGE}FILES+=	test_read_format_rar5_blake2.rar.uu
562
${PACKAGE}FILES+=	test_read_format_rar5_block_size_is_too_small.rar.uu
580
${PACKAGE}FILES+=	test_read_format_rar5_block_size_is_too_small.rar.uu
563
${PACKAGE}FILES+=	test_read_format_rar5_compressed.rar.uu
581
${PACKAGE}FILES+=	test_read_format_rar5_compressed.rar.uu
Lines 566-571 ${PACKAGE}FILES+= test_read_format_rar5_different_solid_window_size.rar.uu Link Here
566
${PACKAGE}FILES+=	test_read_format_rar5_different_window_size.rar.uu
584
${PACKAGE}FILES+=	test_read_format_rar5_different_window_size.rar.uu
567
${PACKAGE}FILES+=	test_read_format_rar5_different_winsize_on_merge.rar.uu
585
${PACKAGE}FILES+=	test_read_format_rar5_different_winsize_on_merge.rar.uu
568
${PACKAGE}FILES+=	test_read_format_rar5_distance_overflow.rar.uu
586
${PACKAGE}FILES+=	test_read_format_rar5_distance_overflow.rar.uu
587
${PACKAGE}FILES+=	test_read_format_rar5_encrypted.rar.uu
588
${PACKAGE}FILES+=	test_read_format_rar5_encrypted_filenames.rar.uu
589
${PACKAGE}FILES+=	test_read_format_rar5_solid_encrypted.rar.uu
590
${PACKAGE}FILES+=	test_read_format_rar5_solid_encrypted_filenames.rar.uu
569
${PACKAGE}FILES+=	test_read_format_rar5_extra_field_version.rar.uu
591
${PACKAGE}FILES+=	test_read_format_rar5_extra_field_version.rar.uu
570
${PACKAGE}FILES+=	test_read_format_rar5_fileattr.rar.uu
592
${PACKAGE}FILES+=	test_read_format_rar5_fileattr.rar.uu
571
${PACKAGE}FILES+=	test_read_format_rar5_hardlink.rar.uu
593
${PACKAGE}FILES+=	test_read_format_rar5_hardlink.rar.uu
Lines 608-618 ${PACKAGE}FILES+= test_read_format_tar_empty_with_gnulabel.tar.uu Link Here
608
${PACKAGE}FILES+=	test_read_format_tar_empty_pax.tar.Z.uu
630
${PACKAGE}FILES+=	test_read_format_tar_empty_pax.tar.Z.uu
609
${PACKAGE}FILES+=	test_read_format_tar_filename_koi8r.tar.Z.uu
631
${PACKAGE}FILES+=	test_read_format_tar_filename_koi8r.tar.Z.uu
610
${PACKAGE}FILES+=	test_read_format_tar_invalid_pax_size.tar.uu
632
${PACKAGE}FILES+=	test_read_format_tar_invalid_pax_size.tar.uu
633
${PACKAGE}FILES+=	test_read_format_tar_pax_large_attr.tar.Z.uu
611
${PACKAGE}FILES+=	test_read_format_ustar_filename_cp866.tar.Z.uu
634
${PACKAGE}FILES+=	test_read_format_ustar_filename_cp866.tar.Z.uu
612
${PACKAGE}FILES+=	test_read_format_ustar_filename_eucjp.tar.Z.uu
635
${PACKAGE}FILES+=	test_read_format_ustar_filename_eucjp.tar.Z.uu
613
${PACKAGE}FILES+=	test_read_format_ustar_filename_koi8r.tar.Z.uu
636
${PACKAGE}FILES+=	test_read_format_ustar_filename_koi8r.tar.Z.uu
614
${PACKAGE}FILES+=	test_read_format_warc.warc.uu
637
${PACKAGE}FILES+=	test_read_format_warc.warc.uu
615
${PACKAGE}FILES+=	test_read_format_xar_doublelink.xar.uu
638
${PACKAGE}FILES+=	test_read_format_xar_doublelink.xar.uu
639
${PACKAGE}FILES+=	test_read_format_xar_duplicate_filename_node.xar.uu
616
${PACKAGE}FILES+=	test_read_format_zip.zip.uu
640
${PACKAGE}FILES+=	test_read_format_zip.zip.uu
617
${PACKAGE}FILES+=	test_read_format_zip_7075_utf8_paths.zip.uu
641
${PACKAGE}FILES+=	test_read_format_zip_7075_utf8_paths.zip.uu
618
${PACKAGE}FILES+=	test_read_format_zip_7z_deflate.zip.uu
642
${PACKAGE}FILES+=	test_read_format_zip_7z_deflate.zip.uu
(-)b/usr.bin/cpio/tests/Makefile (+1 lines)
Lines 33-38 TESTS_SRCS= \ Link Here
33
	test_0.c				\
33
	test_0.c				\
34
	test_basic.c				\
34
	test_basic.c				\
35
	test_cmdline.c				\
35
	test_cmdline.c				\
36
	test_extract_cpio_absolute_paths.c	\
36
	test_extract_cpio_Z.c			\
37
	test_extract_cpio_Z.c			\
37
	test_extract_cpio_bz2.c			\
38
	test_extract_cpio_bz2.c			\
38
	test_extract_cpio_grz.c			\
39
	test_extract_cpio_grz.c			\
(-)b/usr.bin/tar/tests/Makefile (+1 lines)
Lines 47-52 TESTS_SRCS= \ Link Here
47
	test_option_H_upper.c			\
47
	test_option_H_upper.c			\
48
	test_option_L_upper.c			\
48
	test_option_L_upper.c			\
49
	test_option_O_upper.c			\
49
	test_option_O_upper.c			\
50
	test_option_P.c				\
50
	test_option_T_upper.c			\
51
	test_option_T_upper.c			\
51
	test_option_U_upper.c			\
52
	test_option_U_upper.c			\
52
	test_option_X_upper.c			\
53
	test_option_X_upper.c			\

Return to bug 282047