summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-02-22 13:33:48 +0100
committerPatrick Steinhardt <ps@pks.im>2016-02-23 11:50:23 +0100
commit2129d6df93ba0ad5b2f7cf15d4e3cfa39487d5a0 (patch)
treed28c9a0508d04ea4824fd12603a9e759500276d3
parentb9f28b8d52d595943eb416fec8f5bd3f5ec21f5b (diff)
downloadlibgit2-2129d6df93ba0ad5b2f7cf15d4e3cfa39487d5a0.tar.gz
crlf: do not ignore GIT_PASSTHROUGH error
When no payload is set for `crlf_apply` we try to compute the crlf attributes ourselves with `crlf_check`. When the function determines that the current file does not require any treatment we return the GIT_PASSTHROUGH error code without actually allocating the out-pointer, which indicates the file should not be passed through the filter. The `crlf_apply` function explicitly checks for the GIT_PASSTHROUGH return code and ignores it. This means we will try to apply the crlf-filter to the current file, leading us to dereference the unallocated payload-pointer. Fix this obviously incorrect behavior by not treating GIT_PASSTHROUGH in any special way. This is the correct thing to do anyway, as the code indicates that the file should not be passed through the filter.
-rw-r--r--src/crlf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crlf.c b/src/crlf.c
index f391137c1..5d7510ac7 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -346,7 +346,7 @@ static int crlf_apply(
/* initialize payload in case `check` was bypassed */
if (!*payload) {
int error = crlf_check(self, payload, src, NULL);
- if (error < 0 && error != GIT_PASSTHROUGH)
+ if (error < 0)
return error;
}