aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mblaze/0001-mgenmid-printb36-fix-off-by-one.patch
blob: 23bcfec55cfea9d1d6af99fce172103b049741c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 6f99ef55a8bd75d99882078b50e3c7665106c514 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Mon, 21 Aug 2017 19:40:00 +0200
Subject: [PATCH 1/2] mgenmid: printb36: fix off-by-one

Closes #73.
---
 mgenmid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mgenmid.c b/mgenmid.c
index 36aa8c8..655df95 100644
--- a/mgenmid.c
+++ b/mgenmid.c
@@ -21,9 +21,10 @@ printb36(uint64_t x)
 
 	char outbuf[16];
 	char *o = outbuf + sizeof outbuf;
-	*o = 0;
 
+	*--o = 0;
 	do { *--o = base36[x % 36]; } while (x /= 36);
+
 	fputs(o, stdout);
 }
 
-- 
2.14.1