From a8e1217917fc18651f3fdfe8f7a122f1e1b2c238 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 22 Apr 2026 12:02:34 -0400 Subject: stasis_main: exit on memory error --- src/cli/stasis/stasis_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c index 697791a..b2d17b4 100644 --- a/src/cli/stasis/stasis_main.c +++ b/src/cli/stasis/stasis_main.c @@ -30,14 +30,19 @@ static void setup_sysconfdir() { static void setup_python_version_override(struct Delivery *ctx, const char *version) { // Override Python version from command-line, if any - if (strlen(version)) { + if (version && strlen(version)) { guard_free(ctx->meta.python); ctx->meta.python = strdup(version); if (!ctx->meta.python) { SYSERROR("%s", "Unable to allocate bytes for python version override"); + exit(1); } guard_free(ctx->meta.python_compact); ctx->meta.python_compact = to_short_version(ctx->meta.python); + if (!ctx->meta.python_compact) { + SYSERROR("%s", "Unable to allocate bytes for python compact version override"); + exit(1); + } } } -- cgit From a009035b2744be16836aebd81c18bb1a437d236e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 22 Apr 2026 16:04:02 -0400 Subject: Use snprintf --- src/cli/stasis/stasis_main.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c index b2d17b4..01a126e 100644 --- a/src/cli/stasis/stasis_main.c +++ b/src/cli/stasis/stasis_main.c @@ -698,6 +698,12 @@ int main(int argc, char *argv[]) { configure_delivery_context(&ctx); configure_jfrog_cli(&ctx); + /* + delivery_free(&ctx); + tpl_free(); + globals_free(); + return 0; + */ runtime_apply(ctx.runtime.environ); strncpy(env_name, ctx.info.release_name, sizeof(env_name) - 1); -- cgit From 44ed1c60ad8f838bfb6cfff26683bf706285552a Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 23 Apr 2026 01:26:03 -0400 Subject: Fix snprintfs --- src/cli/stasis/args.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/cli/stasis') diff --git a/src/cli/stasis/args.c b/src/cli/stasis/args.c index 98b4479..e1c49fe 100644 --- a/src/cli/stasis/args.c +++ b/src/cli/stasis/args.c @@ -105,9 +105,7 @@ void usage(char *progname) { strncat(opt_short, " ", sizeof(opt_short) - strlen(opt_short) - 1); } - const char *opt_fmt = " %%-%ds\t%%s\t\t%%s"; - size_t opt_fmt_len = snprintf(NULL, 0, opt_fmt, width); - snprintf(tmp, sizeof(tmp) - opt_fmt_len, opt_fmt, width + 4); + snprintf(tmp, sizeof(tmp) - strlen(tmp), " %%-%ds\t%%s\t\t%%s", width + 4); snprintf(output, sizeof(output), tmp, opt_long, opt_short, long_options_help[x]); puts(output); } -- cgit