diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-23 12:06:04 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-23 12:06:04 -0400 |
| commit | ec2d1c4348e0584b157e28a58b926ea2042f7222 (patch) | |
| tree | f3abbfa0b7632e250361b0e2dcc1e81e6a226d39 | |
| parent | 1230d4d2d300320f15f670d683c741a374bec3a0 (diff) | |
| download | stasis-ec2d1c4348e0584b157e28a58b926ea2042f7222.tar.gz | |
Fix snprintf maxlen
| -rw-r--r-- | src/lib/core/conda.c | 5 |
1 files changed, 2 insertions, 3 deletions
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); } |
