diff options
author | Jiri Kosina <jkosina@suse.cz> | 2022-01-10 09:49:13 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2022-01-10 09:49:13 +0100 |
commit | 8a2094d679d921d104d3296528d4fa419702ce1c (patch) | |
tree | 5feeb2f8b94eb3632109b778276ccd1007486770 /usr/gen_init_cpio.c | |
parent | 3809fe479861194e310c23ed48b010c7c0f72d22 (diff) | |
parent | b60d3c803d7603432a08aeaf988aff53b3a5ec64 (diff) |
Merge branch 'for-5.17/core' into for-linus
- support for USI style pens (Tero Kristo, Mika Westerberg)
- quirk for devices that need inverted X/Y axes (Alistair Francis)
- small core code cleanups and deduplication (Benjamin Tissoires)
Diffstat (limited to 'usr/gen_init_cpio.c')
-rw-r--r-- | usr/gen_init_cpio.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index 03b21189d58b..0e2c8a5838b1 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c @@ -188,7 +188,7 @@ struct generic_type { mode_t mode; }; -static struct generic_type generic_type_table[] = { +static const struct generic_type generic_type_table[] = { [GT_DIR] = { .type = "dir", .mode = S_IFDIR @@ -320,6 +320,12 @@ static int cpio_mkfile(const char *name, const char *location, goto error; } + if (buf.st_mtime > 0xffffffff) { + fprintf(stderr, "%s: Timestamp exceeds maximum cpio timestamp, clipping.\n", + location); + buf.st_mtime = 0xffffffff; + } + filebuf = malloc(buf.st_size); if (!filebuf) { fprintf (stderr, "out of memory\n"); @@ -491,7 +497,7 @@ static void usage(const char *prog) prog); } -struct file_handler file_handler_table[] = { +static const struct file_handler file_handler_table[] = { { .type = "file", .handler = cpio_mkfile_line, @@ -551,6 +557,16 @@ int main (int argc, char *argv[]) } } + /* + * Timestamps after 2106-02-07 06:28:15 UTC have an ascii hex time_t + * representation that exceeds 8 chars and breaks the cpio header + * specification. + */ + if (default_mtime > 0xffffffff) { + fprintf(stderr, "ERROR: Timestamp too large for cpio format\n"); + exit(1); + } + if (argc - optind != 1) { usage(argv[0]); exit(1); |