From: Keith Packard Date: Sun, 10 Dec 2017 08:02:34 +0000 (-0800) Subject: altos/scheme: Avoid crashing with non-list in length X-Git-Tag: 1.8.3~1^2~21^2 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=abb856cd66e00d739e4efb1930b5c168eaf48029 altos/scheme: Avoid crashing with non-list in length Use ao_scheme_cons_cdr to fetch the next list element as that returns NULL for non-cons elements. Signed-off-by: Keith Packard --- diff --git a/src/scheme/ao_scheme_cons.c b/src/scheme/ao_scheme_cons.c index 03dad956..21ee10cc 100644 --- a/src/scheme/ao_scheme_cons.c +++ b/src/scheme/ao_scheme_cons.c @@ -195,7 +195,7 @@ ao_scheme_cons_length(struct ao_scheme_cons *cons) int len = 0; while (cons) { len++; - cons = ao_scheme_poly_cons(cons->cdr); + cons = ao_scheme_cons_cdr(cons); } return len; }