m4-1.4

J. Jones jjones at darkside.dynup.net
Fri Aug 10 14:05:26 PDT 2001


This patch deals with

  * m4 format string vulnerabilities
    http://www.securityfocus.com/archive/82/165007
  * mktemp -> mkstemp conversion
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=84416


-------------- next part --------------
diff -NPru m4-1.4-orig/src/builtin.c m4-1.4/src/builtin.c
--- m4-1.4-orig/src/builtin.c	Wed Aug 31 11:45:12 1994
+++ m4-1.4/src/builtin.c	Fri Aug 10 15:32:10 2001
@@ -1076,9 +1076,14 @@
 static void
 m4_maketemp (struct obstack *obs, int argc, token_data **argv)
 {
+  int fd;
   if (bad_argc (argv[0], argc, 2, 2))
     return;
-  mktemp (ARG (1));
+  if ((fd = mkstemp (ARG (1))) < 0) {
+		M4ERROR ((warning_status, errno, "Cannot create tempfile %s", ARG (1)));
+		return;
+  }
+  close (fd);
   obstack_grow (obs, ARG (1), strlen (ARG (1)));
 }
 
diff -NPru m4-1.4-orig/src/m4.c m4-1.4/src/m4.c
--- m4-1.4-orig/src/m4.c	Tue Nov  1 21:14:28 1994
+++ m4-1.4/src/m4.c	Fri Aug 10 15:11:44 2001
@@ -369,7 +369,7 @@
 
       case 'o':
 	if (!debug_set_output (optarg))
-	  error (0, errno, optarg);
+	  error (0, errno, "%s", optarg);
 	break;
 
       case 's':
@@ -466,7 +466,7 @@
 	    fp = path_search (argv[optind]);
 	    if (fp == NULL)
 	      {
-		error (0, errno, argv[optind]);
+		error (0, errno, "%s", argv[optind]);
 		continue;
 	      }
 	    else


More information about the lfs-security mailing list