Add a patch to make unzck require a *.zck extension.
authorPeter Pentchev <roam@debian.org>
Sun, 31 May 2020 13:24:27 +0000 (16:24 +0300)
committerPeter Pentchev <roam@debian.org>
Sun, 31 May 2020 21:46:41 +0000 (00:46 +0300)
debian/patches/series [new file with mode: 0644]
debian/patches/unzck-require-ext.patch [new file with mode: 0644]

diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..b0d7ca7
--- /dev/null
@@ -0,0 +1 @@
+unzck-require-ext.patch
diff --git a/debian/patches/unzck-require-ext.patch b/debian/patches/unzck-require-ext.patch
new file mode 100644 (file)
index 0000000..83778fb
--- /dev/null
@@ -0,0 +1,21 @@
+Description: unzck: require a *.zck extension.
+Forwarded: https://github.com/zchunk/zchunk/pull/26
+Author: Peter Pentchev <roam@ringlet.net>
+Last-Update: 2020-06-01
+
+--- a/src/unzck.c
++++ b/src/unzck.c
+@@ -120,6 +120,13 @@
+     zck_set_log_level(arguments.log_level);
++    if(!arguments.std_out) {
++        if(strlen(arguments.args[0]) < 5 ||
++           strcmp(arguments.args[0] + strlen(arguments.args[0]) - 4, ".zck") != 0) {
++            dprintf(STDERR_FILENO, "Not a *.zck file: %s\n", arguments.args[0]);
++            exit(1);
++        }
++    }
+     int src_fd = open(arguments.args[0], O_RDONLY);
+     if(src_fd < 0) {
+         dprintf(STDERR_FILENO, "Unable to open %s\n", arguments.args[0]);