From 84b5c623ff6118f9a5781ffb6893dbab6e290458 Mon Sep 17 00:00:00 2001 From: "Justin J. Meza" Date: Sun, 27 Mar 2016 13:23:57 -0700 Subject: [PATCH] patching with @donabrams's fix --- binding.c | 6 +++--- interpreter.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/binding.c b/binding.c index 6f8a377..9a3dcc4 100644 --- a/binding.c +++ b/binding.c @@ -10,6 +10,9 @@ char *sanitizeInput(char *input) int c; void *mem = NULL; while (c = input[pos]) { + temp[cur] = (char)c; + cur++; + pos++; /* Reserve space to escape colon in input */ if (c == ':') { cur++; @@ -29,9 +32,6 @@ char *sanitizeInput(char *input) if (c == ':') { temp[cur - 1] = ':'; } - temp[cur] = (char)c; - cur++; - pos++; } temp[cur] = '\0'; return temp; diff --git a/interpreter.c b/interpreter.c index 2f03ae4..82bd8f2 100644 --- a/interpreter.c +++ b/interpreter.c @@ -3204,6 +3204,8 @@ ReturnObject *interpretInputStmtNode(StmtNode *node, * but do not store it. */ if (c == EOF || c == (int)'\r' || c == (int)'\n') break; + temp[cur] = (char)c; + cur++; /* Reserve space to escape colon in input */ if (c == ':') { cur++; @@ -3223,8 +3225,6 @@ ReturnObject *interpretInputStmtNode(StmtNode *node, if (c == ':') { temp[cur - 1] = ':'; } - temp[cur] = (char)c; - cur++; } temp[cur] = '\0'; val = createStringValueObject(temp);