aboutsummaryrefslogtreecommitdiff
path: root/lib/cstr/cstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cstr/cstr.c')
-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];