From: Markus Montkowski Date: Mon, 14 Jul 2025 14:47:23 +0000 (+0200) Subject: get_tmp_outfile fix X-Git-Url: https://git.gnupg.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf5b303913df3b7df9835fd8414ef37a23383d2b;p=gpgol.git get_tmp_outfile fix * 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 --- diff --git a/src/common.cpp b/src/common.cpp index 4c1dbed..0f6282f 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -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.