* exec.c (make_tempdir): Fix bug with a temporary directory on Win32
[gnupg.git] / g10 / exec.c
index fbd935c..924349d 100644 (file)
@@ -129,8 +129,11 @@ static int make_tempdir(struct exec_info *info)
   if(tmp==NULL)
     {
 #if defined (_WIN32)
-      tmp=xmalloc(256);
-      if(GetTempPath(256,tmp)==0)
+      int err;
+
+      tmp=xmalloc(MAX_PATH+1);
+      err=GetTempPath(MAX_PATH+1,tmp);
+      if(err==0 || err>MAX_PATH+1)
        strcpy(tmp,"c:\\windows\\temp");
       else
        {