From 66af1a8ea3f5be50aa9781bfc2a39ae85904254a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 9 Nov 2016 15:50:41 +0000 Subject: [PATCH] fixed a logfmt bug --- lib/bigint.c | 2 +- lib/logfmt.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/bigint.c b/lib/bigint.c index ddeb0a1..6cffc00 100644 --- a/lib/bigint.c +++ b/lib/bigint.c @@ -192,7 +192,7 @@ static int is_normalized_integer (hcl_t* hcl, hcl_oop_t oop) return 0; } -HCL_INLINE int is_bigint (hcl_t* hcl, hcl_oop_t x) +HCL_INLINE static int is_bigint (hcl_t* hcl, hcl_oop_t x) { hcl_oop_t c; diff --git a/lib/logfmt.c b/lib/logfmt.c index db8e707..e67fdef 100644 --- a/lib/logfmt.c +++ b/lib/logfmt.c @@ -217,7 +217,8 @@ redo: } newcapa = HCL_ALIGN(hcl->log.len + len, 512); /* TODO: adjust this capacity */ - tmp = hcl_reallocmem (hcl, hcl->log.ptr, newcapa * HCL_SIZEOF(*tmp)); + /* +1 to handle line ending injection more easily */ + tmp = hcl_reallocmem (hcl, hcl->log.ptr, (newcapa + 1) * HCL_SIZEOF(*tmp)); if (!tmp) { if (hcl->log.len > 0) @@ -231,7 +232,7 @@ redo: } hcl->log.ptr = tmp; - hcl->log.capa = newcapa - 1; /* -1 to handle line ending injection more easily */ + hcl->log.capa = newcapa; } while (len > 0)