From df0989160f359fe70be9ccf01a1a6b0664aaf6a2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 9 Sep 2025 23:49:10 -0400 Subject: Bugfix for file ID accidentally containing NUL byte --- src/tomo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tomo.c b/src/tomo.c index 7bcd4b60..6b80e71b 100644 --- a/src/tomo.c +++ b/src/tomo.c @@ -493,9 +493,10 @@ void compile_files(env_t *env, List_t to_compile, List_t *object_files, List_t * Path_t id_file = build_file(entry->filename, ".id"); if (!Path$exists(id_file)) { static const char id_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + int64_t num_id_chars = (int64_t)strlen(id_chars); char id_str[8]; for (int j = 0; j < (int)sizeof(id_str); j++) { - id_str[j] = id_chars[random_range(0, sizeof(id_chars) - 1)]; + id_str[j] = id_chars[random_range(0, num_id_chars - 1)]; } Text_t filename_id = Text(""); Text_t base = Path$base_name(entry->filename); -- cgit v1.2.3