summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2013-10-13 21:07:28 -0400
committerJeff Layton <jlayton@samba.org>2013-10-14 06:25:45 -0400
commit3aa83995d7c0ef632fe0af3d032e48691a5ce781 (patch)
tree3a429ac954e64560bde42a9057b4dbe422a4d6d7
parent7e2e95d0c84bd6960c46f1fa1c8227c50dd7a4b3 (diff)
downloadcifs-utils-3aa83995d7c0ef632fe0af3d032e48691a5ce781.tar.gz
cifs-utils-3aa83995d7c0ef632fe0af3d032e48691a5ce781.tar.bz2
cifs-utils-3aa83995d7c0ef632fe0af3d032e48691a5ce781.zip
asn1: fix use-after-free in asn1_write
If the talloc_realloc() fails, asn1_write calls talloc_free on the context and then immediately dereferences the pointer. Fix this by skipping the talloc_free here. Let the caller handle it. Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r--asn1.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/asn1.c b/asn1.c
index ea50a23..4c0e480 100644
--- a/asn1.c
+++ b/asn1.c
@@ -47,7 +47,6 @@ bool asn1_write(struct asn1_data *data, const void *p, int len)
uint8_t *newp;
newp = talloc_realloc(data, data->data, uint8_t, data->ofs+len);
if (!newp) {
- asn1_free(data);
data->has_error = true;
return false;
}