From 6bed2eb939717d6f48cbfe6ae324ebe9af5f0915 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Feb 01 2019 12:37:11 +0000 Subject: Fix F30 build by working around the strncpy truncate warning --- diff --git a/e2tools-outpath-bufsize-fix-f30.patch b/e2tools-outpath-bufsize-fix-f30.patch new file mode 100644 index 0000000..3d2be33 --- /dev/null +++ b/e2tools-outpath-bufsize-fix-f30.patch @@ -0,0 +1,42 @@ +diff --git a/copy.c b/copy.c +index 3189c4d..aca8eef 100644 +--- a/copy.c ++++ b/copy.c +@@ -80,6 +80,7 @@ + /* Macros */ + #define USAGE "Usage: e2cp [-0apv][-P mode][-O uid][-G gid][-d dest_dir][-s src_dir][file1...N dest]\n" + #define BUF_SIZE 8192 ++#define OUTBUF_SIZE ((BUF_SIZE)+1) + + #ifdef isspace + #define ISSPACE(c) isspace(c) +@@ -232,7 +233,7 @@ copy(int argc, char *argv[]) + ext2_ino_t orig_cwd = -1; + ext2_ino_t cwd; + char tmpbuf[BUF_SIZE]; +- char outpath[BUF_SIZE]; ++ char outpath[OUTBUF_SIZE]; + char *cur_filesys = NULL; + int retval; + int c; +@@ -463,7 +464,7 @@ copy(int argc, char *argv[]) + { + dest_dir = outpath; + out_file = outpath; +- max_out_len = BUF_SIZE - 1; ++ max_out_len = OUTBUF_SIZE - 1; + } + + if (dst_category == EXT2_FS) +@@ -583,6 +584,11 @@ copy(int argc, char *argv[]) + { + /* create output file name */ + strncpy(out_file, ptr, max_out_len); ++ /* Even though the out_file aka outpath buffer has ++ * size OUTBUF_SIZE which is larger than BUF_SIZE, ++ * we still limit the string length to BUF_SIZE as ++ * some other parts of the code might expect that. ++ */ + outpath[BUF_SIZE-1] = '\0'; + } + diff --git a/e2tools.spec b/e2tools.spec index 3ea6833..c413a19 100644 --- a/e2tools.spec +++ b/e2tools.spec @@ -1,6 +1,6 @@ Name: e2tools Version: 0.0.16.4 -Release: 32%{?dist} +Release: 33%{?dist} Summary: Manipulate files in unmounted ext2/ext3 filesystems # No version specified. @@ -21,6 +21,8 @@ Source7: e2rm.1 Source8: e2tail.1 Source9: e2tools.7 +Patch1: e2tools-outpath-bufsize-fix-f30.patch + BuildRequires: gcc BuildRequires: e2fsprogs-devel >= 1.27 BuildRequires: libcom_err-devel @@ -45,7 +47,7 @@ The utilities are: e2cp e2ln e2ls e2mkdir e2mv e2rm e2tail %prep -%setup -q +%autosetup -v %build @@ -100,6 +102,9 @@ sh %{SOURCE1} %changelog +* Fri Feb 1 2019 Hans Ulrich Niedermann - 0.0.16.4-33 +- Fix F30 build by working around the strncpy truncate warning + * Thu Jan 31 2019 Fedora Release Engineering - 0.0.16.4-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild