[gnome-keyring] [gp11] Fix double free with copied attributes.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] [gp11] Fix double free with copied attributes.
- Date: Fri, 10 Sep 2010 04:50:18 +0000 (UTC)
commit 495468401abe79bde11a86aac19f38df150b7390
Author: Stef Walter <stef memberwebs com>
Date: Fri Sep 10 04:49:46 2010 +0000
[gp11] Fix double free with copied attributes.
Copied attributes would result in a double free if length was zero.
gp11/gp11-attributes.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gp11/gp11-attributes.c b/gp11/gp11-attributes.c
index 5e0b1b1..ecb781e 100644
--- a/gp11/gp11-attributes.c
+++ b/gp11/gp11-attributes.c
@@ -558,8 +558,8 @@ attribute_init_copy (GP11Attribute *dest, const GP11Attribute *src, GP11Allocato
*/
memcpy (dest, src, sizeof (GP11Attribute));
- if (src->value && src->length) {
- dest->value = (allocator) (NULL, src->length);
+ if (src->value) {
+ dest->value = (allocator) (NULL, src->length ? src->length : 1);
g_assert (dest->value);
memcpy (dest->value, src->value, src->length);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]