[svn] GnuPG - r4150 - trunk/g10

svn author dshaw cvs at cvs.gnupg.org
Sat May 27 03:38:55 CEST 2006


Author: dshaw
Date: 2006-05-27 03:38:54 +0200 (Sat, 27 May 2006)
New Revision: 4150

Modified:
   trunk/g10/ChangeLog
   trunk/g10/exec.c
Log:
* exec.c (make_tempdir) [_WIN32]: Modified to properly handle
arbitrarily long temporary directory paths.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2006-05-25 19:39:03 UTC (rev 4149)
+++ trunk/g10/ChangeLog	2006-05-27 01:38:54 UTC (rev 4150)
@@ -1,3 +1,8 @@
+2006-05-25  Israel G. Lugo  <ilugo at bridonsecurity.com> (dshaw)
+
+	* exec.c (make_tempdir) [_WIN32]: Modified to properly handle
+	arbitrarily long temporary directory paths.
+
 2006-05-25  David Shaw  <dshaw at jabberwocky.com>
 
 	* keygen.c (gen_dsa): Allow generating DSA2 keys

Modified: trunk/g10/exec.c
===================================================================
--- trunk/g10/exec.c	2006-05-25 19:39:03 UTC (rev 4149)
+++ trunk/g10/exec.c	2006-05-27 01:38:54 UTC (rev 4150)
@@ -129,16 +129,21 @@
   if(tmp==NULL)
     {
 #if defined (_WIN32)
-      int err;
+      int tmp_siz;
+      int len=0;
 
-      tmp=xmalloc(MAX_PATH+1);
-      err=GetTempPath(MAX_PATH+1,tmp);
-      if(err==0 || err>MAX_PATH+1)
-	strcpy(tmp,"c:\\windows\\temp");
+      /* 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");
       else
 	{
-	  int len=strlen(tmp);
-
 	  /* GetTempPath may return with \ on the end */
 	  while(len>0 && tmp[len-1]=='\\')
 	    {




More information about the Gnupg-commits mailing list