diff options
Diffstat (limited to 'src/lib/delivery')
| -rw-r--r-- | src/lib/delivery/delivery_docker.c | 4 | ||||
| -rw-r--r-- | src/lib/delivery/delivery_install.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/delivery/delivery_docker.c b/src/lib/delivery/delivery_docker.c index e5f1c2f..6aa977a 100644 --- a/src/lib/delivery/delivery_docker.c +++ b/src/lib/delivery/delivery_docker.c @@ -49,7 +49,7 @@ int delivery_docker(struct Delivery *ctx) { const char *tag_fmt = " -t \"%s\" "; const int tag_fmt_len = snprintf(NULL, 0, tag_fmt, tag); - snprintf(args + strlen(args), tag_fmt_len, tag_fmt, tag); + snprintf(args + strlen(args), sizeof(args) - strlen(args) - tag_fmt_len, tag_fmt, tag); } // Append build arguments to command (i.e. --build-arg "key=value" @@ -61,7 +61,7 @@ int delivery_docker(struct Delivery *ctx) { const char *build_arg_fmt = " --build-arg \"%s\" "; const int build_arg_fmt_len = snprintf(NULL, 0, build_arg_fmt, build_arg); - snprintf(args + strlen(args), sizeof(args) - build_arg_fmt_len, build_arg_fmt, build_arg); + snprintf(args + strlen(args), sizeof(args) - strlen(args) - build_arg_fmt_len, build_arg_fmt, build_arg); } // Build the image 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); } } } |
