summaryrefslogtreecommitdiff
path: root/src/erasurecode.c
diff options
context:
space:
mode:
authorTushar Gohad <tusharsg@gmail.com>2016-02-14 07:12:11 +0000
committerTushar Gohad <tusharsg@gmail.com>2016-02-14 07:15:24 +0000
commit17a6dbeb93580be2541c5ea186e3fe83be2e1e6a (patch)
treecf76ef853a509ee94193e1df4c31d331da77e815 /src/erasurecode.c
parentc3ba38d1b2b237033a33f403c470674200133062 (diff)
downloadliberasurecode-17a6dbeb93580be2541c5ea186e3fe83be2e1e6a.tar.gz
Check frag idx validity when verifying frag metadata
... also add related test code
Diffstat (limited to 'src/erasurecode.c')
-rw-r--r--src/erasurecode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/erasurecode.c b/src/erasurecode.c
index 2d6d293..13e5f02 100644
--- a/src/erasurecode.c
+++ b/src/erasurecode.c
@@ -1025,6 +1025,11 @@ out:
int liberasurecode_verify_fragment_metadata(ec_backend_t be,
fragment_metadata_t *md)
{
+ int k = be->args.uargs.k;
+ int m = be->args.uargs.m;
+ if (md->idx < 0 || (md->idx > (k + m))) {
+ return 1;
+ }
if (md->backend_id != be->common.id) {
return 1;
}