1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Use sgrowarray_nm in GetDlgItemText_alloc

GetDlgItemText_alloc is often used to get passwords from text fields,
so the memory should be freed and erased properly. Otherwise parts
of passwords might leak in memory.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
This commit is contained in:
Sven Strickroth 2019-03-19 08:39:08 +01:00 committed by Simon Tatham
parent 7631875d41
commit 674219b115

View File

@ -163,7 +163,7 @@ char *GetDlgItemText_alloc(HWND hwnd, int id)
size_t size = 0;
do {
sgrowarray(ret, size, size);
sgrowarray_nm(ret, size, size);
GetDlgItemText(hwnd, id, ret, size);
} while (!memchr(ret, '\0', size-1));