[libsoup] soup-form: fix soup_form_decode() for multiple values with the same key
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-form: fix soup_form_decode() for multiple values with the same key
- Date: Tue, 18 Jan 2011 22:48:16 +0000 (UTC)
commit b1d9d87385884640426bbc907dcc2568810cb379
Author: Sven Neumann <s neumann raumfeld com>
Date: Tue Jan 18 10:22:26 2011 -0500
soup-form: fix soup_form_decode() for multiple values with the same key
If multiple values in an urlencoded dataset use the same key, the
resulting value in the hash-table created by soup_form_decode() used
to point to memory that is already freed. That is because
g_hash_table_insert() frees the passed key which happens to point
to the memory that contains the new value. Fix this by using
g_hash_table_replace() instead.
libsoup/soup-form.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c
index 59bfd28..9e52793 100644
--- a/libsoup/soup-form.c
+++ b/libsoup/soup-form.c
@@ -105,7 +105,7 @@ soup_form_decode (const char *encoded_form)
continue;
}
- g_hash_table_insert (form_data_set, name, value);
+ g_hash_table_replace (form_data_set, name, value);
}
g_free (pairs);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]