Hello,

tmpnam() might return a NULL pointer if it failed to generate a unique name. Vim doesn't handle it properly. Here's the patch to fix it.

Regards,
Hong Xu
2011/2/6

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r fcea35e2a41f src/fileio.c
--- a/src/fileio.c      Tue Feb 01 21:55:01 2011 +0100
+++ b/src/fileio.c      Sun Feb 06 15:25:54 2011 +0000
@@ -7480,8 +7480,12 @@
 # else /* WIN3264 */
 
 #  ifdef USE_TMPNAM
+    char       *p;
+
     /* tmpnam() will make its own name */
-    if (*tmpnam((char *)itmp) == NUL)
+    p = tmpnam((char *)itmp);
+    /* a unique name cannot be generated if p or *p is NULL */
+    if (p == NULL || *p == NUL)
        return NULL;
 #  else
     char_u     *p;

Raspunde prin e-mail lui