{"thread":{"id":"51096","subject":"[PATCH v2] http-push: prevent format overflow warning with gcc >= 9","startedAt":"2019-05-14T21:21:02Z","lastAt":"2019-05-14T21:21:02Z","messageCount":1,"participants":["Carlo Marcelo Arenas Belón"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"375569","messageId":"20190514211117.63739-1-carenas@gmail.com","threadId":"51096","inReplyTo":null,"subject":"[PATCH v2] http-push: prevent format overflow warning with gcc >= 9","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2019-05-14T21:11:17Z","receivedAt":"2019-05-14T21:21:02Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"In function 'finish_request',\n    inlined from 'process_response' at http-push.c:248:2:\nhttp-push.c:587:4: warning: '%s' directive argument is null [-Wformat-overflow=]\n  587 |    fprintf(stderr, \"Unable to get pack file %s\\n%s\",\n      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n  588 |     request->url, curl_errorstr);\n      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nrequest->url is needed for the error message if there was a failure\nduring fetch but was being cleared unnecessarily earlier.\n\nnote that the leak is prevented by calling release_request unconditionally\nat the end.\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\nSuggested-by: Eric Sunshine <sunshine@sunshineco.com>\n---\n http-push.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex f675a96316..e36561a6db 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -526,8 +526,8 @@ static void finish_request(struct transfer_request *request)\n \tif (request->headers != NULL)\n \t\tcurl_slist_free_all(request->headers);\n \n-\t/* URL is reused for MOVE after PUT */\n-\tif (request->state != RUN_PUT) {\n+\t/* URL is reused for MOVE after PUT and used during FETCH */\n+\tif (request->state != RUN_PUT && request->state != RUN_FETCH_PACKED) {\n \t\tFREE_AND_NULL(request->url);\n \t}\n \n-- \n2.21.0\n\n"}]}