Release: 1.4.1
Environment
Windows XP / Visual C++ .NET 2003 (7.1).
Description
There is an error in the declaration of the function pointer 'func' in w32_shgetfolderpath() in g10/misc.c at line 1030.
The WINAPI macro is placed after the *, causing the compiler to ignore it and issue the warning:
g10\misc.c(1030) : warning C4229: anachronism used : modifiers on data are ignored
As a result, and depending on the default calling convention, it is possible for an incorrect calling convention to be used to call SHGetFolderPathA. This results in a corrupted stack and subsequent runtime failure.
Fix
Change the declaration of 'func' on line 1030 of g10/misc.c from
static HRESULT (* WINAPI func)(HWND,int,HANDLE,DWORD,LPSTR);
to
static HRESULT (WINAPI * func)(HWND,int,HANDLE,DWORD,LPSTR);
. See also the declaration of SHGetFolderPathA in shfolder.h, shipped with the Microsoft Platform SDK.
Release Note
Fixed in cvs. Also in apdu.c.