aboutsummaryrefslogtreecommitdiff
path: root/src/lib/delivery/delivery_install.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-23 01:26:03 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-23 01:26:27 -0400
commit44ed1c60ad8f838bfb6cfff26683bf706285552a (patch)
treee4bae9ececbe5fdddeec4276222132a3e85c4d42 /src/lib/delivery/delivery_install.c
parent821f58a4c54fe8c3fc33fbefd6afb1d7b8b69419 (diff)
downloadstasis-44ed1c60ad8f838bfb6cfff26683bf706285552a.tar.gz
Fix snprintfs
Diffstat (limited to 'src/lib/delivery/delivery_install.c')
-rw-r--r--src/lib/delivery/delivery_install.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/delivery/delivery_install.c b/src/lib/delivery/delivery_install.c
index 26bd98f..22b3752 100644
--- a/src/lib/delivery/delivery_install.c
+++ b/src/lib/delivery/delivery_install.c
@@ -234,9 +234,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha
if (!ctx->meta.based_on) {
strncat(command_base, " --upgrade", sizeof(command_base) - strlen(command_base) - 1);
}
- const char *command_base_fmt = " --extra-index-url 'file://%s'";
- const int len = snprintf(NULL, 0, command_base_fmt, ctx->storage.wheel_artifact_dir);
- snprintf(command_base + strlen(command_base), sizeof(command_base) - len, command_base_fmt, ctx->storage.wheel_artifact_dir);
+ snprintf(command_base + strlen(command_base), sizeof(command_base), " --extra-index-url 'file://%s'", ctx->storage.wheel_artifact_dir);
}
size_t args_alloc_len = STASIS_BUFSIZ;
@@ -320,7 +318,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha
return -1;
}
}
- snprintf(args + strlen(args), sizeof(args) - strlen(args) - required_len + 1, fmt, req, info->version);
+ snprintf(args + strlen(args), args_alloc_len - strlen(args), fmt, req, info->version);
} else {
fprintf(stderr, "Deferred package '%s' is not present in the tested package list!\n", name);
guard_free(args);
@@ -338,7 +336,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha
return -1;
}
}
- snprintf(args + strlen(args), sizeof(args) - strlen(args) - required_len + 1, fmt, name);
+ snprintf(args + strlen(args), args_alloc_len - strlen(args), fmt, name);
} else {
const char *fmt_append = "%s '%s'";
const char *fmt = " '%s'";
@@ -350,7 +348,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha
return -1;
}
}
- snprintf(args + strlen(args), sizeof(args) - strlen(args) - required_len + 1, fmt, name);
+ snprintf(args + strlen(args), args_alloc_len - strlen(args), fmt, name);
}
}
}