summaryrefslogtreecommitdiff
path: root/package/cfgfs
diff options
context:
space:
mode:
Diffstat (limited to 'package/cfgfs')
-rw-r--r--package/cfgfs/src/defs.h2
-rw-r--r--package/cfgfs/src/wraps.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/package/cfgfs/src/defs.h b/package/cfgfs/src/defs.h
index c099ffb5a..5a70d8c14 100644
--- a/package/cfgfs/src/defs.h
+++ b/package/cfgfs/src/defs.h
@@ -10,7 +10,7 @@
#define DEFS_H
#define DEF_FLASHBLOCK 65536 /* size of a flash block */
-#define DEF_FLASHPART 4194304 /* max size of the partition */
+#define DEF_FLASHPART 16777215 /* max size of the partition */
#define FWCF_VER 0x01 /* major version of spec used */
diff --git a/package/cfgfs/src/wraps.c b/package/cfgfs/src/wraps.c
index 288f6dbab..0364c7b71 100644
--- a/package/cfgfs/src/wraps.c
+++ b/package/cfgfs/src/wraps.c
@@ -77,6 +77,14 @@ fwcf_pack(char *odata, size_t i, int algo, size_t *dstsz)
/* 12 bytes header, padding to 4-byte boundary, 4 bytes trailer */
k = ((j + 19) / 4) * 4;
+
+#if DEF_FLASHPART > 0xFFFFFF
+# error DEF_FLASHPART too large
+#endif
+ if (k > DEF_FLASHPART)
+ errx(1, "%lu bytes too large for flash partition of %lu KiB",
+ (u_long)k, DEF_FLASHPART / 1024UL);
+
/* padded to size of flash block */
#if (DEF_FLASHBLOCK & 3)
# error DEF_FLASHBLOCK must be dword-aligned