1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-21 21:15:03 -05:00

Fix null-pointer dereferences in CA config.

Introduced in dc7ba12253c68d1 earlier today. On GTK these caused no
problems worse than a GTK warning, but I'd better fix them before they
(potentially) do worse on Windows!
This commit is contained in:
Simon Tatham 2022-05-02 18:59:26 +01:00
parent c6e40f6785
commit 8c4524aa91

View File

@ -75,7 +75,7 @@ static void ca_refresh_name_list(struct ca_state *st)
static void set_from_hca(struct ca_state *st, host_ca *hca) static void set_from_hca(struct ca_state *st, host_ca *hca)
{ {
sfree(st->name); sfree(st->name);
st->name = dupstr(hca->name); st->name = dupstr(hca->name ? hca->name : "");
sfree(st->pubkey); sfree(st->pubkey);
if (hca->ca_public_key) if (hca->ca_public_key)
@ -405,6 +405,7 @@ void setup_ca_config_box(struct controlbox *b)
memset(st, 0, sizeof(*st)); memset(st, 0, sizeof(*st));
st->ca_names = newtree234(ca_name_compare); st->ca_names = newtree234(ca_name_compare);
st->host_wcs = newtree234(ca_name_compare); st->host_wcs = newtree234(ca_name_compare);
st->wc = dupstr("");
ca_refresh_name_list(st); ca_refresh_name_list(st);
/* Initialise the settings to a default blank host_ca */ /* Initialise the settings to a default blank host_ca */