summaryrefslogtreecommitdiff
path: root/src/scheme/ao_scheme_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scheme/ao_scheme_string.c')
-rw-r--r--src/scheme/ao_scheme_string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/scheme/ao_scheme_string.c b/src/scheme/ao_scheme_string.c
index c49e1e32..2c6d0960 100644
--- a/src/scheme/ao_scheme_string.c
+++ b/src/scheme/ao_scheme_string.c
@@ -47,6 +47,8 @@ ao_scheme_string_alloc(int len)
{
struct ao_scheme_string *s;
+ if (len < 0)
+ return NULL;
s = ao_scheme_alloc(len + 2);
if (!s)
return NULL;
@@ -182,8 +184,8 @@ ao_scheme_string_write(FILE *out, ao_poly p, bool write)
fputs("\\\\", out);
break;
default:
- if (c < ' ')
- fprintf(out, "\\%03o", c);
+ if ((uint8_t) c < ' ')
+ fprintf(out, "\\%03o", (uint8_t) c);
else
putc(c, out);
break;