aboutsummaryrefslogtreecommitdiff
path: root/lib/cstr
diff options
context:
space:
mode:
authorNathan P. Reiner <nathan@nathanreiner.xyz>2022-12-15 18:20:33 +0100
committerNathan P. Reiner <nathan@nathanreiner.xyz>2022-12-15 18:20:33 +0100
commit828dd435725ea315abd2ea9875325ee3b17041a9 (patch)
tree72d80411d5cecc8758fc87867521374e90caa44d /lib/cstr
parent7536d000ac9a5188378f2749ecfd7f0ccb437573 (diff)
did this while lecture (builtins, parsing, exec and env by stdlib)
Diffstat (limited to 'lib/cstr')
-rw-r--r--lib/cstr/cstr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/cstr/cstr.c b/lib/cstr/cstr.c
index fcb91f4..f464cf3 100644
--- a/lib/cstr/cstr.c
+++ b/lib/cstr/cstr.c
@@ -264,7 +264,7 @@ u8 previous_utf8(const char **c)
void u64_to_cstr(u64 n, char *cstr, u64 length)
{
char *p = cstr + length - 1;
- u64 d;
+ u64 d = 0;
int i = 0;
for (;n && i < length; ++i) {
@@ -272,7 +272,7 @@ void u64_to_cstr(u64 n, char *cstr, u64 length)
n /= 10;
}
- d = p - cstr;
+ d = p - cstr + 1;
for (i = 0; i < length - d; ++i)
cstr[i] = cstr[i + d];