aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/ChangeLog5
-rw-r--r--g10/exec.c19
2 files changed, 17 insertions, 7 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 53fc4bcc4..73c99ac10 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-25 Israel G. Lugo <[email protected]> (dshaw)
+
+ * exec.c (make_tempdir) [_WIN32]: Modified to properly handle
+ arbitrarily long temporary directory paths.
+
2006-05-25 David Shaw <[email protected]>
* keygen.c (gen_dsa): Allow generating DSA2 keys
diff --git a/g10/exec.c b/g10/exec.c
index 924349d25..2ad0d327c 100644
--- a/g10/exec.c
+++ b/g10/exec.c
@@ -129,16 +129,21 @@ static int make_tempdir(struct exec_info *info)
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");
- else
+ /* Poll temp path length */
+ tmp_siz=GetTempPath(0,NULL);
+ if(tmp_siz)
{
- int len=strlen(tmp);
+ tmp=xmalloc(tmp_siz);
+ len=GetTempPath(tmp_siz,tmp);
+ }
+ if(len==0)
+ tmp=xstrdup("c:\\windows\\temp");
+ else
+ {
/* GetTempPath may return with \ on the end */
while(len>0 && tmp[len-1]=='\\')
{