diff -ruN nedit-5.7-orig/makefiles/Makefile.macosx nedit-5.7/makefiles/Makefile.macosx --- nedit-5.7-orig/makefiles/Makefile.macosx 2017-02-04 11:46:03.000000000 -0600 +++ nedit-5.7/makefiles/Makefile.macosx 2021-03-31 13:45:26.000000000 -0400 @@ -9,7 +9,7 @@ # Change this line to point at the location your Motif libraries/headers are # installed. (e.g. /usr/local or /sw) Use "locate libXm." to find the # libraries, then remove the /lib suffix. -MOTIFDIR=/usr/local +MOTIFDIR=@PREFIX@ # Use the first line if you're using OpenMotif, use the second if you're using # LessTif from Fink. @@ -19,8 +19,8 @@ # Use the first line to link to Motif statically (highly recommended) or the # second line to link dynamically. With Fink you'll probably have to use # dynamic linking, since they don't normally distribute the static libraries. -MOTIFLINK=${MOTIFDIR}/lib/libXm.a -#MOTIFLINK=-L${MOTIFDIR}/lib -lXm.2 +#MOTIFLINK=${MOTIFDIR}/lib/libXm.a +MOTIFLINK=-L${MOTIFDIR}/lib -lXm ############### You shouldn't need to edit anything below here ############## @@ -36,9 +36,9 @@ # To test if the Motif library exports the runtime version # add -DHAVE__XMVERSIONSTRING to CFLAGS # -CFLAGS=-O -no-cpp-precomp -mdynamic-no-pic -DNO_XMIM -I/usr/X11R6/include \ - -I${MOTIFDIR}/include -DUSE_DIRENT -DUSE_LPR_PRINT_CMD -LIBS= ${EXTRALINKFLAGS} -L/usr/X11R6/lib ${MOTIFLINK} -lXp \ +CFLAGS=-O -no-cpp-precomp -mdynamic-no-pic -DNO_XMIM -I${MOTIFDIR}/include \ + -I@X11DIR@/include -DUSE_DIRENT -DUSE_LPR_PRINT_CMD -MD +LIBS= ${EXTRALINKFLAGS} ${MOTIFLINK} -L@X11DIR@/lib \ -lXpm -lXext -lXt -lSM -lICE -lX11 # diff -ruN nedit-5.7-orig/source/file.c nedit-5.7/source/file.c --- nedit-5.7-orig/source/file.c 2017-02-04 11:07:35.000000000 -0600 +++ nedit-5.7/source/file.c 2020-05-14 17:22:53.000000000 -0500 @@ -1376,7 +1376,7 @@ */ void PrintString(const char *string, int length, Widget parent, const char *jobName) { - char tmpFileName[L_tmpnam]; /* L_tmpnam defined in stdio.h */ + char *tmpFileName=strdup("/tmp/neditXXXXXX"); FILE *fp; int fd; @@ -1387,14 +1387,10 @@ 1. Create a filename 2. Open the file with the O_CREAT|O_EXCL flags So all an attacker can do is a DoS on the print function. */ - tmpnam(tmpFileName); + fd = mkstemp(tmpFileName); /* open the temporary file */ -#ifdef VMS - if ((fp = fopen(tmpFileName, "w", "rfm = stmlf")) == NULL) -#else - if ((fd = open(tmpFileName, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR | S_IWUSR)) < 0 || (fp = fdopen(fd, "w")) == NULL) -#endif /* VMS */ + if ((fp = fdopen(fd, "w")) == NULL) { DialogF(DF_WARN, parent, 1, "Error while Printing", "Unable to write file for printing:\n%s", "OK", @@ -1408,7 +1404,7 @@ /* write to the file */ #ifdef IBM_FWRITE_BUG - write(fileno(fp), string, length); + write(fd, string, length); #else fwrite(string, sizeof(char), length, fp); #endif @@ -1418,6 +1414,7 @@ "%s not printed:\n%s", "OK", jobName, errorString()); fclose(fp); /* should call close(fd) in turn! */ remove(tmpFileName); + free(tmpFileName); return; } @@ -1428,6 +1425,7 @@ "Error closing temp. print file:\n%s", "OK", errorString()); remove(tmpFileName); + free(tmpFileName); return; } @@ -1439,6 +1437,7 @@ PrintFile(parent, tmpFileName, jobName); remove(tmpFileName); #endif /*VMS*/ + free(tmpFileName); return; }