All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH v2 6/6] submodule--helper: introduce new update-module-mode helper
Date: Tue, 17 Jul 2018 09:59:59 +0200	[thread overview]
Message-ID: <20180717075959.30594-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <20180717002654.120375-7-sbeller@google.com>


> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 034ba1bb2e0..d4cb7c72e33 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c


> +static int module_update_module_mode(int argc, const char **argv, const char *prefix)
> +{
> +	const char *path, *update = NULL;
> +	int just_cloned;
> +	struct submodule_update_strategy update_strategy = { .type = SM_UPDATE_CHECKOUT };
> +
> +	if (argc < 3 || argc > 4)
> +		die("submodule--helper update-module-clone expects <just-cloned> <path> [<update>]");
> +
> +	just_cloned = git_config_int("just_cloned", argv[1]);
> +	path = argv[2];
> +
> +	if (argc == 4)
> +		update = argv[3];
> +
> +	determine_submodule_update_strategy(the_repository,
> +					    just_cloned, path, update,
> +					    &update_strategy);
> +	fprintf(stdout, submodule_strategy_to_string(&update_strategy));

Various compilers warn about the potential insecurity of the above
call:

      CC builtin/submodule--helper.o
  builtin/submodule--helper.c: In function ‘module_update_module_mode’:
  builtin/submodule--helper.c:1502:2: error: format not a string literal and no format arguments [-Werror=format-security]
    fprintf(stdout, submodule_strategy_to_string(&update_strategy));
    ^
  cc1: all warnings being treated as errors
  Makefile:2261: recipe for target 'builtin/submodule--helper.o' failed
  make: *** [builtin/submodule--helper.o] Error 1

I think it should either use an explicit format string:

  fprintf(stdout, "%s", submodule_strategy_to_string(&update_strategy));

or, perhaps better yet, simply use fputs().


> +
> +	return 0;
> +}

  reply	other threads:[~2018-07-17  8:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  0:26 [PATCH v2 0/6] git-submodule.sh: convert part of cmd_update to C Stefan Beller
2018-07-17  0:26 ` [PATCH v2 1/6] git-submodule.sh: align error reporting for update mode to use path Stefan Beller
2018-07-17  0:26 ` [PATCH v2 2/6] git-submodule.sh: rename unused variables Stefan Beller
2018-07-17  0:26 ` [PATCH v2 3/6] builtin/submodule--helper: factor out submodule updating Stefan Beller
2018-07-17  0:26 ` [PATCH v2 4/6] builtin/submodule--helper: store update_clone information in a struct Stefan Beller
2018-07-17  0:26 ` [PATCH v2 5/6] builtin/submodule--helper: factor out method to update a single submodule Stefan Beller
2018-07-17  0:26 ` [PATCH v2 6/6] submodule--helper: introduce new update-module-mode helper Stefan Beller
2018-07-17  7:59   ` SZEDER Gábor [this message]
2018-07-17 21:44     ` Junio C Hamano
2018-07-17 18:39 ` [PATCH v2 0/6] git-submodule.sh: convert part of cmd_update to C Junio C Hamano
2018-07-17 18:53   ` Stefan Beller
2018-07-17 18:59     ` Eric Sunshine
2018-07-18 19:34       ` Stefan Beller
2018-07-18 19:55         ` Eric Sunshine
2018-07-18 21:57           ` Junio C Hamano
2018-07-17 19:51     ` Junio C Hamano
2018-07-17 20:56       ` Stefan Beller
2018-07-17 21:39         ` Junio C Hamano
2018-07-26 10:47     ` Johannes Schindelin
2018-07-26 18:14       ` Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180717075959.30594-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.