File 0001-Fixed-endian-problem-in-lha-UTF-16-encoding.patch of Package libarchive

From 8d5f074155be23a2fac92cbd9982215c11691638 Mon Sep 17 00:00:00 2001
From: Claybird <claybird.without.wing@gmail.com>
Date: Tue, 7 Jan 2020 22:07:52 +0900
Subject: [PATCH 1/3] Fixed endian problem in lha UTF-16 encoding.

A patch to fix #1307
---
 libarchive/archive_read_support_format_lha.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c
index 35405bc..f033775 100644
--- a/libarchive/archive_read_support_format_lha.c
+++ b/libarchive/archive_read_support_format_lha.c
@@ -1286,17 +1286,18 @@ lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
 				return (ARCHIVE_FATAL);
 			else {
 				/*
-				 * Convert directory delimiter from 0xFF
+				 * Convert directory delimiter from 0xFFFF
 				 * to '/' for local system.
 				 */
+				uint16_t dirSep = '/';	/* UTF-16LE */
 				/* UTF-16LE character */
 				uint16_t *utf16name = (uint16_t *)lha->dirname.s;
 				for (i = 0; i < lha->dirname.length / 2; i++) {
 					if (utf16name[i] == 0xFFFF)
-						utf16name[i] = L'/';
+						utf16name[i] = dirSep;
 				}
 				/* Is last character directory separator? */
-				if (utf16name[lha->dirname.length / 2 - 1] != L'/')
+				if (utf16name[lha->dirname.length / 2 - 1] != dirSep)
 					/* invalid directory data */
 					goto invalid;
 			}
-- 
2.25.0
openSUSE Build Service is sponsored by