From: Petr Machata <pmachata@gmail.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: [PATCH] libdw: Don't overflow stack with user defined macro attributes array.
Date: Tue, 21 Apr 2015 16:22:53 +0200 [thread overview]
Message-ID: <87vbgpr26a.fsf@gmail.com> (raw)
In-Reply-To: 1429624491-19587-1-git-send-email-mjw@redhat.com
[-- Attachment #1: Type: text/plain, Size: 715 bytes --]
Mark Wielaard <mjw@redhat.com> writes:
> - Dwarf_Attribute attributes[proto->nforms];
> + Dwarf_Attribute *attributes;
> + Dwarf_Attribute *attributesp = NULL;
> + Dwarf_Attribute nattributes[8];
> + if (unlikely (proto->nforms > 8))
> + {
> + attributesp = malloc (sizeof (Dwarf_Attribute) * proto->nforms);
> + if (attributesp == NULL)
> + {
> + __libdw_seterrno (DWARF_E_NOMEM);
> + return -1;
> + }
> + attributes = attributesp;
> + }
> + else
> + attributes = &nattributes[0];
> +
> for (Dwarf_Word i = 0; i < proto->nforms; ++i)
> {
There's a return in this loop that needs free (attributesp) as well.
Thanks,
Petr
next reply other threads:[~2015-04-21 14:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 14:22 Petr Machata [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-04-22 11:46 Mark Wielaard
2015-04-21 18:40 Petr Machata
2015-04-21 18:32 Mark Wielaard
2015-04-21 13:54 Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vbgpr26a.fsf@gmail.com \
--to=pmachata@gmail.com \
--cc=elfutils-devel@lists.fedorahosted.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).