:: commit 5738dc06917d87a94a8ccf2d316111c5d7139a55

mintsuki <mintsuki@protonmail.com> — 2020-05-11 17:50

parents: 736085120c

Make config allocation dynamic

diff --git a/src/lib/config.c b/src/lib/config.c
index ef6103c0..df5fe2c4 100644
--- a/src/lib/config.c
+++ b/src/lib/config.c
@@ -5,7 +5,6 @@
 #include <fs/file.h>
 
 #define SEPARATOR '\n'
-#define MAX_CONFIG_SIZE 4096
 
 static char *config_addr;
 
@@ -18,12 +17,8 @@ int init_config(int drive, int part) {
         }
     }
 
-    if (f.size >= MAX_CONFIG_SIZE) {
-        panic("Config file is too big.");
-    }
-
-    config_addr = balloc(MAX_CONFIG_SIZE);
-    memset(config_addr, 0, MAX_CONFIG_SIZE);
+    config_addr = balloc(f.size + 1);
+    memset(config_addr, 0, f.size + 1);
 
     fread(&f, config_addr, 0, f.size);
 
tab: 248 wrap: offon