From 192b938dbced8c02ce0b8869a797a31285e7e34e Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Sun, 17 Jan 2021 21:05:24 -0700 Subject: Fix j2_cat segfault on long lines Increase j2 max line len and buffer a bit and fix a printf statement that was just printing the input string in place of the format string. Now it prints a format of "%s", with the first argument being the input string now. Whoops. --- src/j2.c | 2 +- src/j2.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/j2.c b/src/j2.c index b636c77..0ed7db8 100644 --- a/src/j2.c +++ b/src/j2.c @@ -78,7 +78,7 @@ int j2_cat(char* path) { varstart = j2_strstr(line); if(!varstart) { - printf(line); + printf("%s", line); continue; } varend = j2_readvar(varstart, buf, J2_MAXBUF); diff --git a/src/j2.h b/src/j2.h index c08f9ec..ca422b8 100644 --- a/src/j2.h +++ b/src/j2.h @@ -20,8 +20,8 @@ #include #include "common.h" -#define J2_MAXLINE 4096 -#define J2_MAXBUF 1024 +#define J2_MAXLINE 1024 * 8 +#define J2_MAXBUF 1024 * 2 char* j2_readvar(char*, char*, int); -- cgit v1.2.3