From 5e742637623af0b1ea365b4c8ffda566a0ee3a2b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 2 Dec 2012 11:38:49 +0100 Subject: filetype: Pass bufsize Pass the buffer size to the file detection code. This makes sure we do not read past the buffer. This is especially useful for ext filesystem detection as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE define which is set to the minimum bufsize the detection code needs to detect all known filetypes. Signed-off-by: Sascha Hauer --- common/uimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/uimage.c') diff --git a/common/uimage.c b/common/uimage.c index 3f5a3d5cd0..3bec6b39f8 100644 --- a/common/uimage.c +++ b/common/uimage.c @@ -516,7 +516,7 @@ void *uimage_load_to_buf(struct uimage_handle *handle, int image_no, if (ret < 0) return NULL; - ft = file_detect_type(ftbuf); + ft = file_detect_type(ftbuf, 128); if ((int)ft < 0) return NULL; -- cgit v1.2.3