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);