From 0557802fc3043119ad79ee4a729eac373b5ec131 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Mon, 30 Oct 2023 14:33:52 +0100 Subject: [PATCH] Fix lib/subcommands.c sprintf usage. (#520) As sprintf gets deprecated, update sources to use snprintf. --- src/bin/lib/subcommands.c/commandline.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/lib/subcommands.c/commandline.c b/src/bin/lib/subcommands.c/commandline.c index bd9eac138..7c5a79ecc 100644 --- a/src/bin/lib/subcommands.c/commandline.c +++ b/src/bin/lib/subcommands.c/commandline.c @@ -274,5 +274,8 @@ commandline_add_breadcrumb(CommandLine *command, CommandLine *subcommand) breadcrumbLength += subcommandLength + 2; subcommand->breadcrumb = (char *) malloc(breadcrumbLength * sizeof(char)); - sprintf(subcommand->breadcrumb, "%s %s", command_bc, subcommand->name); + + snprintf(subcommand->breadcrumb, breadcrumbLength, "%s %s", + command_bc, + subcommand->name); }