summaryrefslogtreecommitdiffstats
path: root/lib/uncompress.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-12-02 11:38:49 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-12-03 11:23:25 +0100
commit5e742637623af0b1ea365b4c8ffda566a0ee3a2b (patch)
tree2e318879a6d386e5cd29639932f9498f6ac6c8b8 /lib/uncompress.c
parent3207dc4608dd1afa46fcdcc0b9eb7c3a3fe22882 (diff)
downloadbarebox-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 'lib/uncompress.c')
-rw-r--r--lib/uncompress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/uncompress.c b/lib/uncompress.c
index 8e4d3a1d91..e0a69df9f9 100644
--- a/lib/uncompress.c
+++ b/lib/uncompress.c
@@ -78,7 +78,7 @@ int uncompress(unsigned char *inbuf, int len,
char *err;
if (inbuf) {
- ft = file_detect_type(inbuf);
+ ft = file_detect_type(inbuf, len);
uncompress_buf = NULL;
uncompress_size = 0;
} else {
@@ -93,7 +93,7 @@ int uncompress(unsigned char *inbuf, int len,
if (ret < 0)
goto err;
- ft = file_detect_type(uncompress_buf);
+ ft = file_detect_type(uncompress_buf, 32);
}
switch (ft) {