summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-04-14 09:59:47 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-04-14 09:59:47 +0000
commit6a42997d802cdd00f6803513e4ad7f442cadcefb (patch)
tree9218b970d63d4bd5d4114cc60626a5131fdc4667
parent20296f5796e8e91e60a9cbe96ca1a6384162d8f6 (diff)
downloadrockbox-6a42997d802cdd00f6803513e4ad7f442cadcefb.tar.gz
rockbox-6a42997d802cdd00f6803513e4ad7f442cadcefb.zip
Magnus Öman's fix to prevent creation of >200K files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3552 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--tools/scramble.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/scramble.c b/tools/scramble.c
index 716b73b569..ca3cea5a58 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -52,6 +52,12 @@ int main (int argc, char** argv)
52 length = ftell(file); 52 length = ftell(file);
53 length = (length + 3) & ~3; /* Round up to nearest 4 byte boundary */ 53 length = (length + 3) & ~3; /* Round up to nearest 4 byte boundary */
54 54
55 if ((length + headerlen) >= 0x32000) {
56 printf("error: max firmware size is 200KB!\n");
57 fclose(file);
58 return -1;
59 }
60
55 fseek(file,0,SEEK_SET); 61 fseek(file,0,SEEK_SET);
56 inbuf = malloc(length); 62 inbuf = malloc(length);
57 outbuf = malloc(length); 63 outbuf = malloc(length);
@@ -129,5 +135,5 @@ int main (int argc, char** argv)
129 free(inbuf); 135 free(inbuf);
130 free(outbuf); 136 free(outbuf);
131 137
132 return 0; 138 return 0;
133} 139}