git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #31002 from yegortimoshenko/bchunk/CVE-2017-15953

bchunk: fix recent CVEs, simplify installPhase

commit7d04f9f8fdf22071f422ba8563d47b9ca04c518c authorJörg Thalheim <Mic92@users.noreply.github.com> dateMon 30 Oct 2017, 21:20 (9 years ago) parent9d74a6194b7368
3 files changed+66−12
pkgs/tools/cd-dvd/bchunk/CVE-2017-15953.patch+25 pkgs/tools/cd-dvd/bchunk/CVE-2017-15955.patch+33 pkgs/tools/cd-dvd/bchunk/default.nix+8−12
pkgs/tools/cd-dvd/bchunk/CVE-2017-15953.patchnew file+25
@@ -0,0 +1,25 @@
1+--- a/bchunk.c 2017-10-30 18:03:58.658741629 +0000
2++++ b/bchunk.c 2017-10-30 19:40:25.558131619 +0000
3+@@ -18,6 +18,7 @@
4+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5+ */
6+
7++#define _GNU_SOURCE
8+ #include <stdio.h>
9+ #include <stdlib.h>
10+ #include <string.h>
11+@@ -271,11 +272,10 @@
12+ int16_t i;
13+ float fl;
14+
15+- if (!(fname = malloc(strlen(bname) + 8))) {
16+- fprintf(stderr, "main(): malloc() failed, out of memory\n");
17++ if (asprintf(&fname, "%s%2.2d.%s", bname, track->num, track->extension) == -1) {
18++ fprintf(stderr, "writetrack(): asprintf() failed, out of memory\n");
19+ exit(4);
20+ }
21+- sprintf(fname, "%s%2.2d.%s", bname, track->num, track->extension);
22+
23+ printf("%2d: %s ", track->num, fname);
24+
25+
pkgs/tools/cd-dvd/bchunk/CVE-2017-15955.patchnew file+33
@@ -0,0 +1,33 @@
1+diff -urNZ bchunk-1.2.0.orig/bchunk.c bchunk-1.2.0/bchunk.c
2+--- a/bchunk.c 2017-10-30 18:03:58.658741629 +0000
3++++ b/bchunk.c 2017-10-30 19:17:36.732855884 +0000
4+@@ -426,11 +426,11 @@
5+ printf("\nTrack ");
6+ if (!(p = strchr(p, ' '))) {
7+ fprintf(stderr, "... ouch, no space after TRACK.\n");
8+- continue;
9++ exit(3);
10+ }
11+ p++;
12+ if (!(t = strchr(p, ' '))) {
13+ fprintf(stderr, "... ouch, no space after track number.\n");
14+- continue;
15++ exit(3);
16+ }
17+ *t = '\0';
18+
19+@@ -460,12 +460,12 @@
20+ } else if ((p = strstr(s, "INDEX"))) {
21+ if (!(p = strchr(p, ' '))) {
22+ printf("... ouch, no space after INDEX.\n");
23+- continue;
24++ exit(3);
25+ }
26+ p++;
27+ if (!(t = strchr(p, ' '))) {
28+ printf("... ouch, no space after index number.\n");
29+- continue;
30++ exit(3);
31+ }
32+ *t = '\0';
33+ t++;
pkgs/tools/cd-dvd/bchunk/default.nix+8−12
@@ -8,20 +8,16 @@ stdenv.mkDerivation rec {
88 sha256 = "0pcbyx3689cbl23dcij497hb3q5f1wmki7cxic5nzldx71g9vp5g";
99 };
1010
11− preConfigure =
12− ''
13− substituteInPlace Makefile \
14− --replace "-o root -g root" "" \
15− --replace "-o bin -g bin" ""
16− '';
11+ patches = [ ./CVE-2017-15953.patch ./CVE-2017-15955.patch ];
1712
18− makeFlags = "PREFIX=$(out) MAN_DIR=$(out)/share/man";
13+ installPhase = ''
14+ install -Dt $out/bin bchunk
15+ install -Dt $out/share/man/man1 bchunk.1
16+ '';
1917
20− preInstall = "mkdir -p $out/bin $out/share/man/man1";
21−
22− meta = {
18+ meta = with stdenv.lib; {
2319 homepage = http://he.fi/bchunk/;
24− description = "A program that converts CD-ROM images in BIN/CUE format into a set of ISO and CDR tracks";
25− platforms = stdenv.lib.platforms.linux;
20+ description = "A program that converts CD images in BIN/CUE format into a set of ISO and CDR tracks";
21+ platforms = platforms.unix;
2622 };
2723}