public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer
@ 2013-12-09 17:09 Albert ARIBAUD
  2013-12-09 17:09 ` [U-Boot] [PATCH v3 2/4] cm_t335: fix linker file to produce full ELF Albert ARIBAUD
  2013-12-13  9:00 ` [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer Albert ARIBAUD
  0 siblings, 2 replies; 11+ messages in thread
From: Albert ARIBAUD @ 2013-12-09 17:09 UTC (permalink / raw)
  To: u-boot

mkexynos reads its input file which might be smaller than
its read buffer, but always writes the whole buffer out.
This does not affect the functionalyty of the output file,
but it makes its content unpredictable as the end of the
buffer is never initialized. Fix this by zeroing the buffer
before reading the input file.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
Changes in v3:
- fixed mkexynosspl uninitialized buffer

Changes in v2: None

 tools/mkexynosspl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/mkexynosspl.c b/tools/mkexynosspl.c
index ef685b7..8d605fa 100644
--- a/tools/mkexynosspl.c
+++ b/tools/mkexynosspl.c
@@ -72,6 +72,8 @@ int main(int argc, char **argv)
 
 	count = (len < CHECKSUM_OFFSET) ? len : CHECKSUM_OFFSET;
 
+	memset(buffer, 0, BUFSIZE);
+
 	if (read(ifd, buffer, count) != count) {
 		fprintf(stderr, "%s: Can't read %s: %s\n",
 			argv[0], argv[1], strerror(errno));
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-12-23  8:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09 17:09 [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer Albert ARIBAUD
2013-12-09 17:09 ` [U-Boot] [PATCH v3 2/4] cm_t335: fix linker file to produce full ELF Albert ARIBAUD
2013-12-09 17:09   ` [U-Boot] [PATCH v3 3/4] arm: make _end compiler-generated Albert ARIBAUD
2013-12-09 17:09     ` [U-Boot] [PATCH v3 4/4] arm: remove unneeded symbol offsets and _TEXT_BASE Albert ARIBAUD
2013-12-13  9:00 ` [U-Boot] [PATCH v3 1/4] mkexynosspl: fix uninitialized buffer Albert ARIBAUD
2013-12-14  5:07   ` Minkyu Kang
2013-12-14 10:14     ` Albert ARIBAUD
2013-12-16  0:48       ` Minkyu Kang
2013-12-16  7:42         ` Rajeshwari Birje
2013-12-21  9:44           ` Albert ARIBAUD
2013-12-23  8:41             ` Minkyu Kang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox