[GnuPG Logo]    
· English ·        
Links  
   
 
authorMarkus Montkowski <[email protected]>
Mon, 14 Jul 2025 14:47:23 +0000 (16:47 +0200)
committerMarkus Montkowski <[email protected]>
Mon, 14 Jul 2025 14:47:23 +0000 (16:47 +0200)
* src/common.cpp: use last dot as start of extension

--
Use last not first dot (.) as start of the file extension.
Limit extension to 10 chars just to be safe.

GnuPG-Bug-Id: 7722

src/common.cpp

index 4c1dbedb8705eb03798cc5a20d3040c9c49457b1..0f6282f5aae3c58e545a26484d04a147d43b68f3 100644 (file)
@@ -631,11 +631,17 @@ get_tmp_outfile (const wchar_t *name, HANDLE *outHandle)
           TRETURN NULL;
         }
 
-      auto fileExt = strchr (lastBackslash, '.');
+      auto fileExt = strrchr (lastBackslash, '.');
       if (fileExt)
         {
           *fileExt = '\0';
           ++fileExt;
+
+          // truncate in case we don't have a real extension and just a point in a filename
+          if (strlen(fileExt) > 10)
+            {
+              fileExt[10] = '\0';
+            }
         }
       // OutNameC is now without an extension and if
       // there is a file ext it now points to the extension.
 
   
 
 
  Technical resources for this
service are sponsered by
 
  g10 Code GmbH  

Valid XHTML 1.0!     Peace!     Valid CSS!