Hi Jacek,
On Fri, 13 Aug 2021 at 23:11, Jacek Caban wrote:
On 8/12/21 3:18 PM, Hugh McMaster wrote:
if (!(screen_buffer->font.face_name = malloc( screen_buffer->font.face_len ))) return NULL;
memcpy( screen_buffer->font.face_name, console->active->font.face_name,
screen_buffer->font.face_len );
if (screen_buffer->font.face_len)
{
screen_buffer->font.face_name = malloc((screen_buffer->font.face_len + 1) * sizeof(WCHAR));
if (!screen_buffer->font.face_name) return NULL;
lstrcpyW(screen_buffer->font.face_name, console->active->font.face_name);
This does not only change the meaning of length, but also null-terminates the string. Is there any reason for that? It doesn't make much sense to both store the length and null-terminate string at the same time.
The FaceName value is stored null-terminated in the registry. It's also null-terminated in the LOGFONTW structure, when copied to the config and in dialogs.
We can probably get rid of face_len though.