summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2021-01-17 21:05:24 -0700
committerAaron Ball <nullspoon@oper.io>2021-01-17 23:47:09 -0700
commit192b938dbced8c02ce0b8869a797a31285e7e34e (patch)
tree77bd19cd2f312a5d723069bf79061e80a7e564d2
parent91b855dd35722fe2296d766949eb72e8cf518f0a (diff)
downloadoper.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.c2
-rw-r--r--src/j2.h4
2 files changed, 3 insertions, 3 deletions
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 <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);

Generated by cgit