From 8235df5a43bd14399f1a3012c4dd0684be1ce491 Mon Sep 17 00:00:00 2001 From: d_m Date: Fri, 20 Sep 2024 22:25:10 -0400 Subject: [PATCH] Fix a bug in stat_size --- src/devices/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/devices/file.c b/src/devices/file.c index 56a1baf..3e124fc 100644 --- a/src/devices/file.c +++ b/src/devices/file.c @@ -282,7 +282,9 @@ stat_size(Uint8 *dest, Uint16 len, off_t size) Uint16 i; dest += len - 1; for (i = 0; i < len; i++) { - *(dest--) = '0' + (Uint8)(size & 0xf); + char c = '0' + (Uint8)(size & 0xf); + if (c > '9') c += 39; + *(dest--) = c; size = size >> 4; } return size == 0 ? len : stat_fill(dest, len, '?');