aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2011-09-01 13:43:03 -0400
committerRuss Cox <rsc@golang.org>2011-09-01 13:43:03 -0400
commitae502c4e02c3728aed9553279c7c787ae3ec39a3 (patch)
treedb7cb0e577e0fa1e23f1e67e0f23683700401845
parentb0bd77f8fb637a6ff9442dd5398b11d90a6ed0eb (diff)
downloadgo-ae502c4e02c3728aed9553279c7c787ae3ec39a3.tar.gz
go-ae502c4e02c3728aed9553279c7c787ae3ec39a3.zip
libmach: fix incorrect use of memset
Fixes #2213. R=rsc CC=golang-dev https://golang.org/cl/4975047
-rw-r--r--src/libmach/executable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libmach/executable.c b/src/libmach/executable.c
index fa0fa1b5fd..9d45323021 100644
--- a/src/libmach/executable.c
+++ b/src/libmach/executable.c
@@ -811,7 +811,7 @@ elf64dotout(int fd, Fhdr *fp, ExecHdr *hp)
buf = malloc(sh[ep->shstrndx].size);
if (buf == 0)
goto done;
- memset(buf, 0, sizeof buf);
+ memset(buf, 0, sh[ep->shstrndx].size);
seek(fd, sh[ep->shstrndx].offset, 0);
i = read(fd, buf, sh[ep->shstrndx].size);
USED(i); // shut up ubuntu gcc
@@ -989,7 +989,7 @@ elfdotout(int fd, Fhdr *fp, ExecHdr *hp)
buf = malloc(sh[ep->shstrndx].size);
if (buf == 0)
goto done;
- memset(buf, 0, sizeof buf);
+ memset(buf, 0, sh[ep->shstrndx].size);
seek(fd, sh[ep->shstrndx].offset, 0);
i = read(fd, buf, sh[ep->shstrndx].size);
USED(i); // shut up ubuntu gcc