]> git.eli173.com Git - klapaucius/commitdiff
fixed major parser error hah
authorElijah Cohen <eli@eli173.com>
Wed, 16 Oct 2024 17:08:06 +0000 (12:08 -0500)
committerElijah Cohen <eli@eli173.com>
Wed, 16 Oct 2024 17:08:06 +0000 (12:08 -0500)
src/parser.c

index 202e2893a6be9395e8bc27fbbee9d198c0341f4b..ae709eca5e41c6292c46b0d44723e0022976d0bb 100644 (file)
@@ -11,8 +11,9 @@
 
 Sexpr* append_fragment(Sexpr* tokens, char* tok_start, size_t currlen) {
        // helper so that i dont repeat code
-       char* newsym = malloc(sizeof(char)*currlen);
+       char* newsym = malloc(sizeof(char)*currlen+1);
        strncpy(newsym, tok_start, currlen);
+       newsym[sizeof(char)*currlen] = '\0';
        Sexpr* newtok = from_sym(newsym);
        free(newsym);
        return cons(newtok, tokens);