diff --git a/config.def.h b/config.def.h index c96a667..31697e9 100644 --- a/config.def.h +++ b/config.def.h @@ -1,3 +1,6 @@ +#define LEXICON_SIZE 1024 +#define TAG_BODY_SIZE 4096 + #define NAME "nilFM" #define DOMAIN "https://nilfm.cc" #define LOGO "blackHole://server" diff --git a/main.c b/main.c index 3ca0a24..49cade3 100644 --- a/main.c +++ b/main.c @@ -21,8 +21,8 @@ WITH REGARD TO THIS SOFTWARE. struct dirent* dir; typedef struct Lexicon { - int len, refs[1024]; - char files[1024][64]; + int len, refs[LEXICON_SIZE]; + char files[LEXICON_SIZE][64]; } Lexicon; /* clang-format off */ @@ -363,7 +363,7 @@ int fpblock(FILE* f, char* s) { int fpmetatemplate(FILE* f, Lexicon* l, char* s) { int bopen, bclose; - char ss[4096]; + char ss[TAG_BODY_SIZE]; unsigned char t = 0; bopen = 0; bclose = 0; @@ -393,8 +393,8 @@ int fpmetatemplate(FILE* f, Lexicon* l, char* s) { continue; } } - if (slen(s) > 4095) - return error("Templating error", "text block over 16k"); + if (slen(s) >= TAG_BODY_SIZE) + return error("Templating error", "text block exceeds tag body size"); if (t) { ccat(ss, *s); } else @@ -459,7 +459,7 @@ int fptemplate(FILE* f, Lexicon* l, char* s) { int fpinject(FILE* f, Lexicon* l, char* filepath) { FILE* inc; int bopen, bclose; - char c, s[4096]; + char c, s[TAG_BODY_SIZE]; unsigned char t = 0; /*fprintf(stderr, "Building: %s\n", filepath);*/ bopen = 0; @@ -494,7 +494,7 @@ int fpinject(FILE* f, Lexicon* l, char* filepath) { continue; } } - if (slen(s) > 4095) + if (slen(s) >= TAG_BODY_SIZE) return error("Templating error", filepath); if (t) ccat(s, c);