summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Greenan <kmgreen2@gmail.com>2015-02-07 14:39:40 -0800
committerKevin Greenan <kmgreen2@gmail.com>2015-02-07 14:40:31 -0800
commit14b1e5bb64e5dac9da2b97b4a4db046aecf61364 (patch)
tree0df868e1b7cc43cdcefa8fe4fda1b99446a28ad6 /src
parentcf490de5e0ab016895a25bff3a1ea6e015163501 (diff)
downloadliberasurecode-14b1e5bb64e5dac9da2b97b4a4db046aecf61364.tar.gz
Fix the extended integrity checks in the liberasurecode decode
function. Previously, it was failing if the number of invalid fragments was k or greater, which is incorrect. We should only be able to decode if: (num given fragments - num invalid fragments) >= k This means fail if: (num given fragments - num invalid fragments) < k
Diffstat (limited to 'src')
-rw-r--r--src/erasurecode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/erasurecode.c b/src/erasurecode.c
index 22aa2e8..ab39228 100644
--- a/src/erasurecode.c
+++ b/src/erasurecode.c
@@ -594,7 +594,7 @@ int liberasurecode_decode(int desc,
++num_invalid_fragments;
}
}
- if (num_invalid_fragments > (k - 1)) {
+ if ((num_fragments - num_invalid_fragments) < k) {
ret = -EINSUFFFRAGS;
log_error("Not enough valid fragments available for decode!");
goto out;