aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/copyin.c9
-rw-r--r--tests/testsuite.at3
2 files changed, 9 insertions, 3 deletions
diff --git a/src/copyin.c b/src/copyin.c
index b29f348..9348923 100644
--- a/src/copyin.c
+++ b/src/copyin.c
@@ -1000,7 +1000,14 @@ read_name_from_file (struct cpio_file_stat *file_hdr, int fd, uintmax_t len)
{
cpio_realloc_c_name (file_hdr, len);
tape_buffered_read (file_hdr->c_name, fd, len);
- file_hdr->c_namesize = len;
+ if (file_hdr->c_name[len-1] == 0)
+ file_hdr->c_namesize = len;
+ else
+ {
+ error (0, 0, _("malformed header: file name is not nul-terminated"));
+ /* Skip this file */
+ file_hdr->c_namesize = 0;
+ }
}
/* Fill in FILE_HDR by reading an old-format ASCII format cpio header from
diff --git a/tests/testsuite.at b/tests/testsuite.at
index aa56bb9..f901b1a 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,8 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU cpio
-# Copyright (C) 2004, 2006-2007, 2010, 2014-2015, 2017 Free Software
-# Foundation, Inc.
+# Copyright (C) 2004-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Return to:

Send suggestions and report system problems to the System administrator.