Edit

IABSD.fr/ports/editors/nedit/patches/patch-source_file_c

Branch :

  • Show log

    Commit

  • Author : jasper
    Date : 2007-06-26 19:54:53
    Hash : bbc653e7
    Message : - add some more keywords for C - remove djm@ as maintainer (per his request) - regen patches while here ok ajacoutot@ djm@

  • editors/nedit/patches/patch-source_file_c
  • $OpenBSD: patch-source_file_c,v 1.6 2007/06/26 19:54:53 jasper Exp $
    --- source/file.c.orig	Tue Aug 24 11:37:24 2004
    +++ source/file.c	Fri Jun 22 17:30:03 2007
    @@ -1314,7 +1314,12 @@ void PrintWindow(WindowInfo *window, int selectedOnly)
     */
     void PrintString(const char *string, int length, Widget parent, const char *jobName)
     {
    +#ifdef HAVE_MKSTEMP
    +    static char template[] = "/var/tmp/nedit-XXXXXXXXXX";
    +    char tmpFileName[sizeof(template)];
    +#else
         char tmpFileName[L_tmpnam];    /* L_tmpnam defined in stdio.h */
    +#endif
         FILE *fp;
         int fd;
     
    @@ -1325,6 +1330,10 @@ void PrintString(const char *string, int length, Widge
     	    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. */
    +#ifdef HAVE_MKSTEMP
    +    strcpy(tmpFileName, template);
    +    if ((fd = mkstemp(tmpFileName)) < 0 || (fp = fdopen(fd, "w")) == NULL)
    +#else
         tmpnam(tmpFileName);
     
         /* open the temporary file */
    @@ -1333,6 +1342,7 @@ void PrintString(const char *string, int length, Widge
     #else
         if ((fd = open(tmpFileName, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR | S_IWUSR)) < 0 || (fp = fdopen(fd, "w")) == NULL)
     #endif /* VMS */
    +#endif /* HAVE_MKSTEMP */
         {
             DialogF(DF_WARN, parent, 1, "Error while Printing",
                     "Unable to write file for printing:\n%s", "OK",