summaryrefslogtreecommitdiff
path: root/src/patch_parse.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-22 23:56:10 -0400
committerDrew DeVault <sir@cmpwn.com>2019-04-05 20:44:10 -0400
commit30c06b601eaf9b87975a3731ad1051d74b1ae73d (patch)
treec577ebc827c3b42f447c25b6367c3c61a7c30929 /src/patch_parse.c
parentaeea1c463941806a0176859c06c0e2e9716efcb0 (diff)
downloadlibgit2-30c06b601eaf9b87975a3731ad1051d74b1ae73d.tar.gz
patch_parse.c: Handle CRLF in parse_header_start
Diffstat (limited to 'src/patch_parse.c')
-rw-r--r--src/patch_parse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 545f1ca9e..d7311157f 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -328,7 +328,8 @@ static int parse_header_start(git_patch_parsed *patch, git_patch_parse_ctx *ctx)
* proceeed here. We then hope for the "---" and "+++" lines to fix that
* for us.
*/
- if (!git_parse_ctx_contains(&ctx->parse_ctx, "\n", 1)) {
+ if (!git_parse_ctx_contains(&ctx->parse_ctx, "\n", 1) &&
+ !git_parse_ctx_contains(&ctx->parse_ctx, "\r\n", 2)) {
git_parse_advance_chars(&ctx->parse_ctx, ctx->parse_ctx.line_len - 1);
git__free(patch->header_old_path);