From 72780f3c218a55eaecbc980cf3e0b6ae56d78f2d Mon Sep 17 00:00:00 2001 From: expan <expan@student.cs.uwaterloo.ca> Date: Thu, 28 Mar 2019 23:17:30 -0400 Subject: [PATCH] fix seg) --- parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parser.c b/parser.c index c508fbd..b346bf0 100644 --- a/parser.c +++ b/parser.c @@ -27,7 +27,7 @@ cons_cell* parse(char* input, int size) { return create_cons_cell(car_cons, cdr_cons); } else { int first_space_idx = 0; - while (input[first_space_idx] != " ") + while (input[first_space_idx] != " " && input[first_space_idx] != NULL) first_space_idx++; char buff_first[500]; @@ -39,7 +39,7 @@ cons_cell* parse(char* input, int size) { next_char++; } - strncpy(buff_other, input[next_char], size - next_char); + strncpy(buff_other, &input[next_char], size - next_char); cons_cell* cdr_cons = parse(buff_other, size-next_char); car_cons->cdr = cdr_cons; return car_cons; -- GitLab