summaryrefslogtreecommitdiff
path: root/src/repodata.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/repodata.c')
-rw-r--r--src/repodata.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/repodata.c b/src/repodata.c
index 0c7a51f..3cae0fe 100644
--- a/src/repodata.c
+++ b/src/repodata.c
@@ -211,11 +211,13 @@ repodata_schema2id(Repodata *data, Id *schema, int create)
cid = schematahash[h];
if (cid)
{
- if (!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))
+ if ((data->schemata[cid] + len <= data->schemadatalen) &&
+ !memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))
return cid;
/* cache conflict, do a slow search */
for (cid = 1; cid < data->nschemata; cid++)
- if (!memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))
+ if ((data->schemata[cid] + len <= data->schemadatalen) &&
+ !memcmp(data->schemadata + data->schemata[cid], schema, len * sizeof(Id)))
return cid;
}
/* a new one */