git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #15649 from rycee/bump/dtach

dtach: 0.8 -> 0.9

commitf010ce65ec869487d86fbfe03966f4c69a6f591b authorArseniy Seroka <jagajaga@users.noreply.github.com> dateTue 24 May 2016, 22:06 (11 years ago) parentc39f7163257ec3
2 files changed+12−60
pkgs/tools/misc/dtach/default.nix+12−11 pkgs/tools/misc/dtach/fix-CVE-2012-3368.patch−49
pkgs/tools/misc/dtach/default.nix+12−11
@@ -1,15 +1,14 @@
11{ stdenv, fetchurl }:
22
33stdenv.mkDerivation rec {
4− name = "dtach-0.8";
4+ name = "dtach-${version}";
5+ version = "0.9";
56
67 src = fetchurl {
7− url = "mirror://sourceforge/project/dtach/dtach/0.8/dtach-0.8.tar.gz";
8− sha256 = "16614ebddf8ab2811d3dc0e7f329c7de88929ac6a9632d4cb4aef7fe11b8f2a9";
8+ url = "mirror://sourceforge/project/dtach/dtach/${version}/${name}.tar.gz";
9+ sha256 = "1wwj2hlngi8qn2pisvhyfxxs8gyqjlgrrv5lz91w8ly54dlzvs9j";
910 };
1011
11− patches = [ ./fix-CVE-2012-3368.patch ];
12−
1312 installPhase = ''
1413 mkdir -p $out/bin
1514 cp dtach $out/bin/dtach
@@ -19,12 +18,14 @@ stdenv.mkDerivation rec {
1918 homepage = http://dtach.sourceforge.net/;
2019 description = "A program that emulates the detach feature of screen";
2120
22− longDescription = ''dtach is a tiny program that emulates the
23− detach feature of screen, allowing you to run a program in an
24− environment that is protected from the controlling terminal and
25− attach to it later. dtach does not keep track of the contents of
26− the screen, and thus works best with programs that know how to
27− redraw themselves.'';
21+ longDescription = ''
22+ dtach is a tiny program that emulates the detach feature of
23+ screen, allowing you to run a program in an environment that is
24+ protected from the controlling terminal and attach to it later.
25+ dtach does not keep track of the contents of the screen, and
26+ thus works best with programs that know how to redraw
27+ themselves.
28+ '';
2829
2930 license = stdenv.lib.licenses.gpl2Plus;
3031
pkgs/tools/misc/dtach/fix-CVE-2012-3368.patchdeleted−49
@@ -1,49 +0,0 @@
1−Fix error handling for read from stdin in attach.c
2−
3−attach.c did not correctly handle a read from stdin when read returned
4−an error. The code assigned the return value of read to pkt.len (an
5−unsigned char) before checking the value. This prevented the error check
6−from working correctly, since an unsigned integer can never be < 0.
7−
8−A packet with an invalid length was then sent to the master, which then
9−sent 255 bytes of garbage to the program.
10−
11−Fix the bug in attach.c and the unchecked packet length bug in master.c.
12−
13−Report and initial patch by Enrico Scholz.
14−
15−--- a/master.c 2012/07/01 21:26:10 1.14
16−+++ b/master.c 2012/07/01 21:44:34 1.15
17−@@ -351,7 +351,10 @@
18−
19− /* Push out data to the program. */
20− if (pkt.type == MSG_PUSH)
21−- write(the_pty.fd, pkt.u.buf, pkt.len);
22−+ {
23−+ if (pkt.len <= sizeof(pkt.u.buf))
24−+ write(the_pty.fd, pkt.u.buf, pkt.len);
25−+ }
26−
27− /* Attach or detach from the program. */
28− else if (pkt.type == MSG_ATTACH)
29−--- a/attach.c 2012/07/01 21:26:10 1.12
30−+++ b/attach.c 2012/07/01 21:44:34 1.13
31−@@ -237,12 +237,16 @@
32− /* stdin activity */
33− if (n > 0 && FD_ISSET(0, &readfds))
34− {
35−+ ssize_t len;
36−+
37− pkt.type = MSG_PUSH;
38− memset(pkt.u.buf, 0, sizeof(pkt.u.buf));
39−- pkt.len = read(0, pkt.u.buf, sizeof(pkt.u.buf));
40−+ len = read(0, pkt.u.buf, sizeof(pkt.u.buf));
41−
42−- if (pkt.len <= 0)
43−+ if (len <= 0)
44− exit(1);
45−+
46−+ pkt.len = len;
47− process_kbd(s, &pkt);
48− n--;
49− }