Revert last. It is still wrong.
authorDavid Shaw <dshaw@jabberwocky.com>
Sat, 27 May 2006 02:07:05 +0000 (02:07 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Sat, 27 May 2006 02:07:05 +0000 (02:07 +0000)
g10/ChangeLog
g10/exec.c

index 73c99ac..53fc4bc 100644 (file)
@@ -1,8 +1,3 @@
-2006-05-25  Israel G. Lugo  <ilugo@bridonsecurity.com> (dshaw)
-
-       * exec.c (make_tempdir) [_WIN32]: Modified to properly handle
-       arbitrarily long temporary directory paths.
-
 2006-05-25  David Shaw  <dshaw@jabberwocky.com>
 
        * keygen.c (gen_dsa): Allow generating DSA2 keys
index 2ad0d32..d99bb5e 100644 (file)
@@ -129,21 +129,16 @@ static int make_tempdir(struct exec_info *info)
   if(tmp==NULL)
     {
 #if defined (_WIN32)
-      int tmp_siz;
-      int len=0;
+      int err;
 
-      /* Poll temp path length */
-      tmp_siz=GetTempPath(0,NULL);
-      if(tmp_siz)
-       {
-         tmp=xmalloc(tmp_siz);
-         len=GetTempPath(tmp_siz,tmp);
-       }
-
-      if(len==0)
-       tmp=xstrdup("c:\\windows\\temp");
+      tmp=xmalloc(MAX_PATH);
+      err=GetTempPath(MAX_PATH,tmp);
+      if(err==0 || err>MAX_PATH)
+       strcpy(tmp,"c:\\windows\\temp");
       else
        {
+         int len=strlen(tmp);
+
          /* GetTempPath may return with \ on the end */
          while(len>0 && tmp[len-1]=='\\')
            {