Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 3443db5

Browse files
peffgitster
authored andcommitted
http_request: reset "type" strbuf before adding
Callers may pass us a strbuf which we use to record the content-type of the response. However, we simply appended to it rather than overwriting its contents, meaning that cruft in the strbuf gave us a bogus type. E.g., the multiple requests triggered by http_request could yield a type like "text/plainapplication/x-git-receive-pack-advertisement". Reported-by: Michael Schubert <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af3aec4 commit 3443db5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

http.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ static int http_request(const char *url, struct strbuf *type,
841841

842842
if (type) {
843843
char *t;
844+
strbuf_reset(type);
844845
curl_easy_getinfo(slot->curl, CURLINFO_CONTENT_TYPE, &t);
845846
if (t)
846847
strbuf_addstr(type, t);

0 commit comments

Comments
 (0)