Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

fix(st.h): replace strcpy with snprintf in shard sort buffer

4ny3l7445150b6796
diff --git a/c/st.h b/c/st.h
index 4270053b..33108efb 100644
--- a/c/st.h
+++ b/c/st.h
@@ -271,7 +271,7 @@ static void st_init_multi(shards *S, const char *snap_dir, const char *extra_dir
ndir, nf, snap_dir, c0);
}
for (int a = 0; a < nf; a++) for (int b = a+1; b < nf; b++)
- if (strcmp(files[a], files[b]) > 0) { char tmp[1024]; strcpy(tmp, files[a]); strcpy(files[a], files[b]); strcpy(files[b], tmp); }
+ if (strcmp(files[a], files[b]) > 0) { char tmp[1024]; snprintf(tmp, sizeof(tmp), "%s", files[a]); snprintf(files[a], 1024, "%s", files[b]); snprintf(files[b], 1024, "%s", tmp); }
for (int fi = 0; fi < nf; fi++) {
int fd = st_open_fd(S, files[fi]);