diff options
author | Aaron Ball <nullspoon@oper.io> | 2021-01-17 21:05:24 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2021-01-17 23:47:09 -0700 |
commit | 192b938dbced8c02ce0b8869a797a31285e7e34e (patch) | |
tree | 77bd19cd2f312a5d723069bf79061e80a7e564d2 | |
parent | 91b855dd35722fe2296d766949eb72e8cf518f0a (diff) | |
download | oper.io-192b938dbced8c02ce0b8869a797a31285e7e34e.tar.gz oper.io-192b938dbced8c02ce0b8869a797a31285e7e34e.tar.xz |
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.
-rw-r--r-- | src/j2.c | 2 | ||||
-rw-r--r-- | src/j2.h | 4 |
2 files changed, 3 insertions, 3 deletions
@@ -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); @@ -20,8 +20,8 @@ #include <string.h> #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); |