Commit 6fc82343 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

user32: Pad lfFaceName so we don't write uninitialised data to the registry.

Found by Valgrind.
parent a7326271
......@@ -699,10 +699,20 @@ static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue
/* Convenience function to save logical fonts */
static BOOL SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey, LPCWSTR lpValName,
LPLOGFONTW plf, UINT fWinIni )
const LPLOGFONTW plf, UINT fWinIni )
{
return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)plf,
sizeof( LOGFONTW), REG_BINARY, fWinIni );
LOGFONTW lf = *plf;
int len;
/* Zero pad the end of lfFaceName so we don't write uninitialised
data to the registry */
lf.lfFaceName[LF_FACESIZE-1] = 0;
len = strlenW(lf.lfFaceName);
if(len < LF_FACESIZE-1)
memset(lf.lfFaceName + len, 0, (LF_FACESIZE - 1 - len) * sizeof(WCHAR));
return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)&lf,
sizeof(LOGFONTW), REG_BINARY, fWinIni );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment