Blame SOURCES/0001-asn1-fix-use-after-free-in-asn1_write.patch

97823b
From 3aa83995d7c0ef632fe0af3d032e48691a5ce781 Mon Sep 17 00:00:00 2001
97823b
From: Jeff Layton <jlayton@samba.org>
97823b
Date: Sun, 13 Oct 2013 21:07:28 -0400
97823b
Subject: [PATCH] asn1: fix use-after-free in asn1_write
97823b
97823b
If the talloc_realloc() fails, asn1_write calls talloc_free on the
97823b
context and then immediately dereferences the pointer.
97823b
97823b
Fix this by skipping the talloc_free here. Let the caller handle it.
97823b
97823b
Signed-off-by: Jeff Layton <jlayton@samba.org>
97823b
---
97823b
 asn1.c | 1 -
97823b
 1 file changed, 1 deletion(-)
97823b
97823b
diff --git a/asn1.c b/asn1.c
97823b
index ea50a23..4c0e480 100644
97823b
--- a/asn1.c
97823b
+++ b/asn1.c
97823b
@@ -47,7 +47,6 @@ bool asn1_write(struct asn1_data *data, const void *p, int len)
97823b
 		uint8_t *newp;
97823b
 		newp = talloc_realloc(data, data->data, uint8_t, data->ofs+len);
97823b
 		if (!newp) {
97823b
-			asn1_free(data);
97823b
 			data->has_error = true;
97823b
 			return false;
97823b
 		}
97823b
-- 
97823b
1.8.3.1
97823b