diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-09-09 23:49:10 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-09-09 23:49:10 -0400 |
| commit | df0989160f359fe70be9ccf01a1a6b0664aaf6a2 (patch) | |
| tree | 23ab7ad6e01e224b1543930a381cb199cb9bba21 /src/tomo.c | |
| parent | 86a76c06616527fb3d6305c1069d167204628f9e (diff) | |
Bugfix for file ID accidentally containing NUL byte
Diffstat (limited to 'src/tomo.c')
| -rw-r--r-- | src/tomo.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |
