From ec2d1c4348e0584b157e28a58b926ea2042f7222 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 23 Apr 2026 12:06:04 -0400 Subject: Fix snprintf maxlen --- src/lib/core/conda.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/core/conda.c b/src/lib/core/conda.c index d8ac390..854d56d 100644 --- a/src/lib/core/conda.c +++ b/src/lib/core/conda.c @@ -61,7 +61,7 @@ int micromamba(const struct MicromambaInfo *info, char *command, ...) { } va_start(args, command); - cmd_len = vsnprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd) - cmd_len, command, args); + cmd_len = vsnprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd), command, args); if (cmd_len < 0) { SYSERROR("%s", "Unable to append arguments to micromamba command"); va_end(args); @@ -527,8 +527,7 @@ int conda_setup_headless() { if (isempty(item)) { continue; } - const int cmd_fmt_len = snprintf(NULL, 0, cmd_fmt, item); - snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd) - cmd_fmt_len, cmd_fmt, item); + snprintf(cmd + strlen(cmd), sizeof(cmd) - strlen(cmd), cmd_fmt, item); if (i < total - 1) { strncat(cmd, " ", sizeof(cmd) - strlen(cmd) - 1); } -- cgit