Make sure that there is at least 8 bytes available to be read,
and only read exactly 8 bytes.
Signed-off-by: Simon Horman <[EMAIL PROTECTED]>
Index: kexec-tools-testing/kexec/arch/ppc64/fs2dt.c
===================================================================
--- kexec-tools-testing.orig/kexec/arch/ppc64/fs2dt.c 2006-12-11
14:46:20.000000000 +0900
+++ kexec-tools-testing/kexec/arch/ppc64/fs2dt.c 2006-12-11
14:47:16.000000000 +0900
@@ -114,11 +114,15 @@
static void add_usable_mem_property(int fd, int len)
{
char fname[MAXPATH], *bname;
- char buf[MAXBYTES +1];
+ unsigned long long buf[2];
unsigned long ranges[2*MAX_MEMORY_RANGES];
unsigned long long base, end, loc_base, loc_end;
int range, rlen = 0;
+ if (len < 2 * sizeof(unsigned long long))
+ die("unrecoverable error: not enough data for mem property\n");
+ len = 2 * sizeof(unsigned long long);
+
strcpy(fname, pathname);
bname = strrchr(fname,'/');
bname[0] = '\0';
--
--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot