Fix PR 45558 (aka CVE-2011-4119) which also turns out to affect Moscow ML. Credit to Florian Weimer for noticing this.diff -r1.28 -r1.29 pkgsrc/lang/moscow_ml/Makefile
(dholland)
@@ -1,17 +1,18 @@ | @@ -1,17 +1,18 @@ | |||
1 | # $NetBSD: Makefile,v 1.28 2008/04/28 10:16:57 tnn Exp $ | 1 | # $NetBSD: Makefile,v 1.29 2011/11/08 12:41:30 dholland Exp $ | |
2 | 2 | |||
3 | DISTNAME= mos201src | 3 | DISTNAME= mos201src | |
4 | PKGNAME= moscow_ml-2.01 | 4 | PKGNAME= moscow_ml-2.01 | |
5 | PKGREVISION= 1 | |||
5 | CATEGORIES= lang | 6 | CATEGORIES= lang | |
6 | MASTER_SITES= http://www.itu.dk/people/sestoft/mosml/ | 7 | MASTER_SITES= http://www.itu.dk/people/sestoft/mosml/ | |
7 | 8 | |||
8 | MAINTAINER= pkgsrc-users@NetBSD.org | 9 | MAINTAINER= pkgsrc-users@NetBSD.org | |
9 | HOMEPAGE= http://www.dina.kvl.dk/~sestoft/mosml.html | 10 | HOMEPAGE= http://www.dina.kvl.dk/~sestoft/mosml.html | |
10 | COMMENT= Moscow ML, a version of Standard ML | 11 | COMMENT= Moscow ML, a version of Standard ML | |
11 | 12 | |||
12 | PKG_DESTDIR_SUPPORT= user-destdir | 13 | PKG_DESTDIR_SUPPORT= user-destdir | |
13 | 14 | |||
14 | WRKSRC= ${WRKDIR}/mosml/src | 15 | WRKSRC= ${WRKDIR}/mosml/src | |
15 | USE_TOOLS+= perl | 16 | USE_TOOLS+= perl | |
16 | 17 | |||
17 | BUILD_TARGET= clean world | 18 | BUILD_TARGET= clean world |
@@ -1,18 +1,19 @@ | @@ -1,18 +1,19 @@ | |||
1 | $NetBSD: distinfo,v 1.5 2008/04/28 10:16:57 tnn Exp $ | 1 | $NetBSD: distinfo,v 1.6 2011/11/08 12:41:30 dholland Exp $ | |
2 | 2 | |||
3 | SHA1 (mos201src.tar.gz) = eba58486b10f0359fafba488fa1bf366b2aabf8a | 3 | SHA1 (mos201src.tar.gz) = eba58486b10f0359fafba488fa1bf366b2aabf8a | |
4 | RMD160 (mos201src.tar.gz) = b2a9582d8c0bfdad2b8a74740e54ab33d3856637 | 4 | RMD160 (mos201src.tar.gz) = b2a9582d8c0bfdad2b8a74740e54ab33d3856637 | |
5 | Size (mos201src.tar.gz) = 2314392 bytes | 5 | Size (mos201src.tar.gz) = 2314392 bytes | |
6 | SHA1 (patch-aa) = ffe745a14f8b41d2c1c278fbd6f7057a856a1e47 | 6 | SHA1 (patch-aa) = ffe745a14f8b41d2c1c278fbd6f7057a856a1e47 | |
7 | SHA1 (patch-ab) = f4f4d6307a145041e60322c91f1b5359c744cc93 | 7 | SHA1 (patch-ab) = f4f4d6307a145041e60322c91f1b5359c744cc93 | |
8 | SHA1 (patch-ac) = 76d59a2370334a6e87a01d29f75b4700463d60f8 | 8 | SHA1 (patch-ac) = 76d59a2370334a6e87a01d29f75b4700463d60f8 | |
9 | SHA1 (patch-ad) = d76f87ed98eb836e926d0781824531694b287ad7 | 9 | SHA1 (patch-ad) = d76f87ed98eb836e926d0781824531694b287ad7 | |
10 | SHA1 (patch-ae) = 2e2875d9997233e6696833f92d7ae77c4930499d | 10 | SHA1 (patch-ae) = 2e2875d9997233e6696833f92d7ae77c4930499d | |
11 | SHA1 (patch-ba) = 2e6d61ef16ed7bc064d828fd22fc5c96e12cf357 | 11 | SHA1 (patch-ba) = 2e6d61ef16ed7bc064d828fd22fc5c96e12cf357 | |
12 | SHA1 (patch-bb) = 7ec9c19d43a0d758ecc2655b7da131e58dbe9739 | 12 | SHA1 (patch-bb) = 7ec9c19d43a0d758ecc2655b7da131e58dbe9739 | |
13 | SHA1 (patch-bc) = 99953744072bb2ad603469b411b4bd5f33a935f7 | 13 | SHA1 (patch-bc) = 99953744072bb2ad603469b411b4bd5f33a935f7 | |
14 | SHA1 (patch-bd) = 3e73d03cec930463c0d3d1a2c3e874b0c8c8a459 | 14 | SHA1 (patch-bd) = 3e73d03cec930463c0d3d1a2c3e874b0c8c8a459 | |
15 | SHA1 (patch-be) = 4742e5391e5ac9d7c5339c69b6d47d237659feed | 15 | SHA1 (patch-be) = 4742e5391e5ac9d7c5339c69b6d47d237659feed | |
16 | SHA1 (patch-bf) = 3bafc00ea7b2fd8c7992f0dc36cb4467e6815de6 | 16 | SHA1 (patch-bf) = 3bafc00ea7b2fd8c7992f0dc36cb4467e6815de6 | |
17 | SHA1 (patch-bg) = 6ca89fb870ef066a2929b9cd7e38257c9380cd11 | 17 | SHA1 (patch-bg) = 6ca89fb870ef066a2929b9cd7e38257c9380cd11 | |
18 | SHA1 (patch-bh) = e9a12cf9804e46379c9e97c567eef974a2f7ca62 | 18 | SHA1 (patch-bh) = e9a12cf9804e46379c9e97c567eef974a2f7ca62 | |
19 | SHA1 (patch-mosmlyac_main_c) = d9d6a624c33f96a25e866c64944d0f20cedea526 |
$NetBSD: patch-mosmlyac_main_c,v 1.1 2011/11/08 12:41:30 dholland Exp $
Avoid insecure use of mktemp().
--- mosmlyac/main.c.orig 2000-04-28 09:38:45.000000000 +0000
+++ mosmlyac/main.c
@@ -1,6 +1,9 @@
#include <signal.h>
#ifdef ANSI
#include <string.h>
+#include <stdlib.h>
+#else
+extern char *getenv();
#endif
#include "defs.h"
@@ -33,6 +36,11 @@ char *text_file_name;
char *union_file_name;
char *verbose_file_name;
+static int action_fd = -1;
+static int entry_fd = -1;
+static int text_fd = -1;
+static int union_fd = -1;
+
FILE *action_file; /* a temp file, used to save actions associated */
/* with rules until the parser is written */
FILE *entry_file;
@@ -71,9 +79,6 @@ char *rassoc;
short **derives;
char *nullable;
-extern char *mktemp();
-extern char *getenv();
-
void done(int k)
{
@@ -276,12 +281,21 @@ void create_file_names(void)
union_file_name[len + 5] = 'u';
#ifndef NO_UNIX
- mktemp(action_file_name);
- mktemp(entry_file_name);
- mktemp(text_file_name);
- mktemp(union_file_name);
+ action_fd = mkstemp(action_file_name);
+ entry_fd = mkstemp(entry_file_name);
+ text_fd = mkstemp(text_file_name);
+ union_fd = mkstemp(union_file_name);
#endif
+ if (action_fd < 0)
+ open_error(action_file_name);
+ if (entry_fd < 0)
+ open_error(entry_file_name);
+ if (text_fd < 0)
+ open_error(text_file_name);
+ if (union_fd < 0)
+ open_error(union_file_name);
+
len = strlen(file_prefix);
output_file_name = MALLOC(len + 7);
@@ -321,15 +335,15 @@ void open_files(void)
open_error(input_file_name);
}
- action_file = fopen(action_file_name, "w");
+ action_file = fdopen(action_fd, "w");
if (action_file == 0)
open_error(action_file_name);
- entry_file = fopen(entry_file_name, "w");
+ entry_file = fdopen(entry_fd, "w");
if (entry_file == 0)
open_error(entry_file_name);
- text_file = fopen(text_file_name, "w");
+ text_file = fdopen(text_fd, "w");
if (text_file == 0)
open_error(text_file_name);
@@ -345,7 +359,7 @@ void open_files(void)
defines_file = fopen(defines_file_name, "w");
if (defines_file == 0)
open_error(defines_file_name);
- union_file = fopen(union_file_name, "w");
+ union_file = fdopen(union_fd, "w");
if (union_file == 0)
open_error(union_file_name);
}