From 9bc880ae05787ed7982601c59760e610af94c041 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 21 Feb 2022 20:16:38 -0800 Subject: [PATCH] Fix missing trailing quote when displaying strings --- src/lake.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lake.c b/src/lake.c index aed2e4d..61d541a 100644 --- a/src/lake.c +++ b/src/lake.c @@ -49,7 +49,8 @@ char *lake_repr(void *expr) case TYPE_STR: { - size_t n = strlen(STR_S(STR(e))) + 2; + // +3 for surrounding quotes and null terminator + size_t n = strlen(STR_S(STR(e))) + 3; s = malloc(n); /* TODO: quote the string */ snprintf(s, n, "\"%s\"", STR_S(STR(e)));