[PATCH] ASN1: Fix NULL pointer dereference on stack allocation failure.
Kp <[email protected]> Sun, 1 Jun 2008 12:05:14 -0500
| Newsgroups | gmane.network.silc.devel |
|---|---|
| Message-ID | <[email protected]> |
If the second silc_stack_alloc fails, then asn1->stack2 is NULL. Thus, when silc_asn1_init calls silc_stack_free(asn1->stack2), it is equivalent to silc_stack_free(NULL). However, silc_stack_free does not check for a NULL pointer. Fix silc_asn1_init to free asn1->stack1, as was intended. This patch is based on silc.1.1.branch. The attached patch should be suitable for direct consumption with git am. _______________________________________________________________________ Info: https://lists.silcnet.org/mailman/listinfo/silc-announce Archive: https://lists.silcnet.org/pipermail/silc-announce FAQ: http://silcnet.org/support/faq/
0001-ASN1-Fix-NULL-pointer-dereference-on-stack-allocati.patch
(text/plain, 995 B)
From 179c735a82e2067acb9f80a85f741555483ff92e Mon Sep 17 00:00:00 2001 From: Kp <[email protected]> Date: Fri, 30 May 2008 23:31:07 -0500 Subject: [PATCH] ASN1: Fix NULL pointer dereference on stack allocation failure. If the second silc_stack_alloc fails, then asn1->stack2 is NULL. Thus, when silc_asn1_init calls silc_stack_free(asn1->stack2), it is equivalent to silc_stack_free(NULL). However, silc_stack_free does not check for a NULL pointer. Fix silc_asn1_init to free asn1->stack1, as was intended. --- lib/silcasn1/silcasn1.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/silcasn1/silcasn1.c b/lib/silcasn1/silcasn1.c index 5965228..2e43b49 100644 --- a/lib/silcasn1/silcasn1.c +++ b/lib/silcasn1/silcasn1.c @@ -53,7 +53,7 @@ SilcBool silc_asn1_init(SilcAsn1 asn1) asn1->stack2 = silc_stack_alloc(768); if (!asn1->stack2) { - silc_stack_free(asn1->stack2); + silc_stack_free(asn1->stack1); return FALSE; } -- 1.5.5.1