diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-12-02 11:38:49 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-12-03 11:23:25 +0100 |
commit | 5e742637623af0b1ea365b4c8ffda566a0ee3a2b (patch) | |
tree | 2e318879a6d386e5cd29639932f9498f6ac6c8b8 /arch/arm/mach-imx/imx-bbu-internal.c | |
parent | 3207dc4608dd1afa46fcdcc0b9eb7c3a3fe22882 (diff) | |
download | barebox-5e742637623af0b1ea365b4c8ffda566a0ee3a2b.tar.gz barebox-5e742637623af0b1ea365b4c8ffda566a0ee3a2b.tar.xz |
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/imx-bbu-internal.c')
-rw-r--r-- | arch/arm/mach-imx/imx-bbu-internal.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c index c34f86f33a..881c20ae9a 100644 --- a/arch/arm/mach-imx/imx-bbu-internal.c +++ b/arch/arm/mach-imx/imx-bbu-internal.c @@ -110,7 +110,7 @@ static int imx_bbu_internal_v1_update(struct bbu_handler *handler, struct bbu_da int ret, image_len; void *buf; - if (file_detect_type(data->image) != filetype_arm_barebox) { + if (file_detect_type(data->image, data->len) != filetype_arm_barebox) { if (!bbu_force(data, "Not an ARM barebox image")) return -EINVAL; } @@ -332,7 +332,7 @@ static int imx_bbu_internal_v2_update(struct bbu_handler *handler, struct bbu_da int ret, image_len; void *buf; - if (file_detect_type(data->image) != filetype_arm_barebox) { + if (file_detect_type(data->image, data->len) != filetype_arm_barebox) { if (!bbu_force(data, "Not an ARM barebox image")) return -EINVAL; } |