* [PATCH] hexdump: don't access hex after freeing it
@ 2013-12-27 13:45 Andrey Vagin
2014-01-06 13:01 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Vagin @ 2013-12-27 13:45 UTC (permalink / raw)
To: util-linux; +Cc: Karel Zak, Andrew Vagin
From: Andrew Vagin <avagin@openvz.org>
==20209== Invalid read of size 4
==20209== at 0x923C: main (hexdump.c:202)
==20209== Address 0x49af034 is 12 bytes inside a block of size 32 free'd
==20209== at 0x48348B8: free (vg_replace_malloc.c:427)
==20209== by 0x923B: main (hexdump.c:200)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
text-utils/hexdump.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c
index 1806077..cebd676 100644
--- a/text-utils/hexdump.c
+++ b/text-utils/hexdump.c
@@ -165,11 +165,13 @@ int main(int argc, char **argv)
{
struct list_head *p;
struct hexdump_fs *tfs;
+ int ret;
char *c;
struct hexdump *hex = malloc (sizeof (struct hexdump));
hex->length = -1;
hex->skip = 0;
+ hex->exitval = 0;
INIT_LIST_HEAD(&hex->fshead);
setlocale(LC_ALL, "");
@@ -197,8 +199,9 @@ int main(int argc, char **argv)
next(argv, hex);
display(hex);
+ ret = hex->exitval;
hex_free(hex);
- return hex->exitval;
+ return ret;
}
void hex_free(struct hexdump *hex)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hexdump: don't access hex after freeing it
2013-12-27 13:45 [PATCH] hexdump: don't access hex after freeing it Andrey Vagin
@ 2014-01-06 13:01 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-01-06 13:01 UTC (permalink / raw)
To: Andrey Vagin; +Cc: util-linux
On Fri, Dec 27, 2013 at 05:45:06PM +0400, Andrey Vagin wrote:
> text-utils/hexdump.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-06 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-27 13:45 [PATCH] hexdump: don't access hex after freeing it Andrey Vagin
2014-01-06 13:01 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox