diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2014-09-15 19:12:14 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2014-11-13 22:01:12 +0100 |
commit | 28f04eb2bcff369ab13f3c98c00b7bcbf91594d3 (patch) | |
tree | 94ca1a4d9b9d08b4b86f4e5bdf4641e5b3698376 /egg/egg-asn1x.c | |
parent | 6da13bb815c3893ab305316ca3f08faaf0093953 (diff) | |
download | gnome-keyring-28f04eb2bcff369ab13f3c98c00b7bcbf91594d3.tar.gz |
asn1x: Sanitize use of asn1_set_value/asn1_take_value
Most callers of asn1_set_value() seems to assume this function will take
ownership of the passed in GBytes, while it actually takes an additional
reference.
https://bugzilla.gnome.org/show_bug.cgi?id=738508
Diffstat (limited to 'egg/egg-asn1x.c')
-rw-r--r-- | egg/egg-asn1x.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/egg/egg-asn1x.c b/egg/egg-asn1x.c index f0a81cb7..197ab375 100644 --- a/egg/egg-asn1x.c +++ b/egg/egg-asn1x.c @@ -2765,7 +2765,7 @@ egg_asn1x_set_null (GNode *node) /* Encode zero characters */ anode_clr_value (node); - anode_set_value (node, g_bytes_new_static ("", 0)); + anode_take_value (node, g_bytes_new_static ("", 0)); } GQuark @@ -2828,7 +2828,7 @@ egg_asn1x_set_enumerated (GNode *node, anode_write_integer_ulong (val, data, &n_data); anode_clr_value (node); - anode_set_value (node, g_bytes_new_take (data, n_data)); + anode_take_value (node, g_bytes_new_take (data, n_data)); } gboolean @@ -2979,7 +2979,7 @@ egg_asn1x_take_integer_as_raw (GNode *node, } anode_clr_value (node); - anode_set_value (node, value); + anode_take_value (node, value); an = node->data; an->guarantee_unsigned = 0; @@ -3003,7 +3003,7 @@ egg_asn1x_take_integer_as_usg (GNode *node, g_return_if_fail (value != NULL); g_return_if_fail (anode_def_type (node) == EGG_ASN1X_INTEGER); - anode_set_value (node, value); + anode_take_value (node, value); an = node->data; an->guarantee_unsigned = 1; } @@ -3283,8 +3283,8 @@ egg_asn1x_set_string_as_raw (GNode *node, type == EGG_ASN1X_UTF8_STRING || type == EGG_ASN1X_VISIBLE_STRING); - anode_set_value (node, g_bytes_new_with_free_func (data, n_data, - destroy, data)); + anode_take_value (node, g_bytes_new_with_free_func (data, n_data, + destroy, data)); } void @@ -3308,7 +3308,7 @@ egg_asn1x_set_string_as_bytes (GNode *node, type == EGG_ASN1X_UTF8_STRING || type == EGG_ASN1X_VISIBLE_STRING); - anode_set_value (node, g_bytes_ref (bytes)); + anode_set_value (node, bytes); } GBytes * |