From 577d1965cbcacb6d82b5ae0f79f865ede57e885f Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 5 Aug 2022 17:14:33 +0100 Subject: [PATCH] Fixed a missing string terminator --- scripts/example.toy | 44 ++++++++++++++++++++++++++++++++++++++++++++ source/literal.c | 1 + 2 files changed, 45 insertions(+) diff --git a/scripts/example.toy b/scripts/example.toy index a606f7e..ac7d3ee 100644 --- a/scripts/example.toy +++ b/scripts/example.toy @@ -9,3 +9,47 @@ print -4.20; print "hello world"; print "hello world"; print "hello world"; +print "hello world"; +print null; +print true; +print false; +print 42; +print 3.14; +print -69; +print -4.20; +print "hello world"; +print "hello world"; +print "hello world"; +print "hello world"; +print null; +print true; +print false; +print 42; +print 3.14; +print -69; +print -4.20; +print "hello world"; +print "hello world"; +print "hello world"; +print "hello world"; +print null; +print true; +print false; +print 42; +print 3.14; +print -69; +print -4.20; +print "hello world"; +print "hello world"; +print "hello world"; +print "hello world"; +print null; +print true; +print false; +print 42; +print 3.14; +print -69; +print -4.20; +print "hello world"; +print "hello world"; +print "hello world"; diff --git a/source/literal.c b/source/literal.c index 3ec5570..24c59af 100644 --- a/source/literal.c +++ b/source/literal.c @@ -55,5 +55,6 @@ Literal _toStringLiteral(char* cstr) { char* copyString(char* original, int length) { char* buffer = ALLOCATE(char, length + 1); strncpy(buffer, original, length); + buffer[length] = '\0'; return buffer; } \ No newline at end of file