diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-04-22 18:25:09 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-04-22 18:25:09 -0700 |
commit | 9fb0a22dcb1ae04a1007316497fe6d11b91d8183 (patch) | |
tree | 4f78507d5131a6c798e62da64997b6db2782ed4a /sys/libn | |
parent | fb4c4ceba416376751196cdbbdb5f7240e08a405 (diff) |
fix: moved byte buffer to static storage so you don't read off stale stack
Diffstat (limited to 'sys/libn')
-rw-r--r-- | sys/libn/string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/libn/string.c b/sys/libn/string.c index 9bcef90..d5bb7ef 100644 --- a/sys/libn/string.c +++ b/sys/libn/string.c @@ -187,7 +187,7 @@ cleanup: string str·newlen(const byte* s, vlong len) { - vlong sl = (s == nil) ? 0 : strlen(s); + vlong sl = (!s) ? 0 : strlen(s); if (sl < len) panicf("attempted to take a bigger substring than string length"); vlong cap = (len == 0) ? 1 : len; @@ -199,7 +199,7 @@ str·newlen(const byte* s, vlong len) string str·new(const byte* s) { - vlong len = (s == nil) ? 0 : strlen(s); + vlong len = (!s) ? 0 : strlen(s); return str·newlen(s, len); } |