diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-04-10 14:02:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-10 14:02:50 +0200 |
commit | e1b8fb24c39f2f1f90ce48324983310bfbf16346 (patch) | |
tree | 717c86bb9ba9f70d9d91b3559689955a885f22ab /src/xmpp | |
parent | c90a5d174e46f8bd95ebe4198624b5e199e1748e (diff) | |
parent | 44377c6a5ca96ec6334619d49d6a4f486c5a8d21 (diff) | |
download | profani-tty-e1b8fb24c39f2f1f90ce48324983310bfbf16346.tar.gz |
Merge pull request #1309 from profanity-im/use-after-free
Fix use-after-free in stanza_create_caps_from_query_element()
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/stanza.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 8791100b..56185843 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -1784,13 +1784,13 @@ stanza_create_caps_from_query_element(xmpp_stanza_t *query) formField = field->data; if (formField->values) { if (strcmp(formField->var, "software") == 0) { - software = formField->values->data; + software = strdup(formField->values->data); } else if (strcmp(formField->var, "software_version") == 0) { - software_version = formField->values->data; + software_version = strdup(formField->values->data); } else if (strcmp(formField->var, "os") == 0) { - os = formField->values->data; + os = strdup(formField->values->data); } else if (strcmp(formField->var, "os_version") == 0) { - os_version = formField->values->data; + os_version = strdup(formField->values->data); } } field = g_slist_next(field); @@ -1872,6 +1872,10 @@ stanza_create_caps_from_query_element(xmpp_stanza_t *query) EntityCapabilities *result = caps_create(category, type, name, software, software_version, os, os_version, features); g_slist_free_full(features, free); + free(software); + free(software_version); + free(os); + free(os_version); return result; } |