Skip to content

Commit

Permalink
Infostore: guard against UAF
Browse files Browse the repository at this point in the history
Don't free the key without having copied it first, otherwise callers
won't know if it's valid or not.

Via Theo Buehler.
  • Loading branch information
ThomasAdam committed Sep 30, 2023
1 parent 018bd06 commit 9811e73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fvwm/infostore.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void insert_metainfo(char *key, char *value)

/* It's a new item, add it to the list. */
mi_new = new_metainfo();
mi_new->key = key;
mi_new->key = fxstrdup(key);
CopyString(&mi_new->value, value);

mi_new->next = mi_store;
Expand Down Expand Up @@ -192,6 +192,7 @@ void CMD_InfoStoreAdd(F_CMD_ARGS)
}

insert_metainfo(key, value);
free(key);
free(value);

return;
Expand Down

0 comments on commit 9811e73

Please sign in to comment.