From: Eric Sunshine <sunshine@sunshineco.com>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Cc: Git List <git@vger.kernel.org>,
nickh@reactrix.com, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] http-push: workaround for format overflow warning in gcc >= 9
Date: Fri, 10 May 2019 03:50:32 -0400 [thread overview]
Message-ID: <CAPig+cSY4SKXcppM6UYpeJ3z+PrUwiJ=whCmHQv4e_3CUZSwoQ@mail.gmail.com> (raw)
In-Reply-To: <20190510065848.27606-1-carenas@gmail.com>
On Fri, May 10, 2019 at 2:59 AM Carlo Marcelo Arenas Belón
<carenas@gmail.com> wrote:
> In function 'finish_request',
> inlined from 'process_response' at http-push.c:248:2:
> http-push.c:587:4: warning: '%s' directive argument is null [-Wformat-overflow=]
> 587 | fprintf(stderr, "Unable to get pack file %s\n%s",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 588 | request->url, curl_errorstr);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
Missing sign-off.
> diff --git a/http-push.c b/http-push.c
> @@ -585,7 +585,8 @@ static void finish_request(struct transfer_request *request)
> int fail = 1;
> if (request->curl_result != CURLE_OK) {
> fprintf(stderr, "Unable to get pack file %s\n%s",
> - request->url, curl_errorstr);
> + request->url ? request->url : "",
> + curl_errorstr);
> } else {
If I'm reading the code correctly, the conditional and "true" branch
of the ternary expression are dead code since 'request->url' will
unconditionally be NULL due to the:
/* URL is reused for MOVE after PUT */
if (request->state != RUN_PUT) {
FREE_AND_NULL(request->url);
}
earlier in the function. If you want to present a meaningful error
message here, I could imagine squirreling-away the URL so it can be
used in the error message, or re-working the code so that
FREE_AND_NULL(request->url) is only done when and if needed.
next prev parent reply other threads:[~2019-05-10 7:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 6:58 [PATCH] http-push: workaround for format overflow warning in gcc >= 9 Carlo Marcelo Arenas Belón
2019-05-10 7:50 ` Eric Sunshine [this message]
2019-05-13 5:57 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cSY4SKXcppM6UYpeJ3z+PrUwiJ=whCmHQv4e_3CUZSwoQ@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=carenas@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nickh@reactrix.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).