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/lib/delivery/delivery_install.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/delivery/delivery_install.c') diff --git a/src/lib/delivery/delivery_install.c b/src/lib/delivery/delivery_install.c index 51b78fa..26bd98f 100644 --- a/src/lib/delivery/delivery_install.c +++ b/src/lib/delivery/delivery_install.c @@ -320,7 +320,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha return -1; } } - snprintf(args + strlen(args), required_len + 1, fmt, req, info->version); + snprintf(args + strlen(args), sizeof(args) - strlen(args) - required_len + 1, 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 +338,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha return -1; } } - snprintf(args + strlen(args), required_len + 1, fmt, name); + snprintf(args + strlen(args), sizeof(args) - strlen(args) - required_len + 1, fmt, name); } else { const char *fmt_append = "%s '%s'"; const char *fmt = " '%s'"; @@ -350,7 +350,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha return -1; } } - snprintf(args + strlen(args), required_len + 1, fmt, name); + snprintf(args + strlen(args), sizeof(args) - strlen(args) - required_len + 1, fmt, name); } } } -- cgit