Skip to content

Commit bfcfb19

Browse files
unamedkrclaude
andcommitted
Fix GCC -Wformat-truncation: enlarge snprintf buffer in find_tensor
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 691728b commit bfcfb19

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/engine/tq_model.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,7 @@ static tensor_info_t* find_tensor(tensor_info_t* tensors, int n,
307307
for (int p = 1; NAME_PREFIXES[p] != NULL; p++) {
308308
const char* prefix = NAME_PREFIXES[p];
309309
if (strncmp(name, "model.", 6) == 0) {
310-
char alt[MAX_NAME_LEN];
311-
/* Replace "model." with "model." + prefix
312-
* e.g., "model.layers.0.foo" -> "model.language_model.layers.0.foo" */
310+
char alt[MAX_NAME_LEN * 2];
313311
snprintf(alt, sizeof(alt), "model.%s%s", prefix, name + 6);
314312
for (int i = 0; i < n; i++) {
315313
if (strcmp(tensors[i].name, alt) == 0) {

0 commit comments

Comments
 (0)