blob: validate strings on parse

This commit is contained in:
Felix Fietkau 2011-01-31 03:30:41 +01:00
parent da2876acd9
commit ec593913f4

5
blob.c
View file

@ -142,6 +142,7 @@ blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_at
blob_for_each_attr(pos, attr, rem) { blob_for_each_attr(pos, attr, rem) {
int id = blob_id(pos); int id = blob_id(pos);
int len = blob_len(pos); int len = blob_len(pos);
char *pdata;
if (id >= max) if (id >= max)
continue; continue;
@ -158,6 +159,10 @@ blob_parse(struct blob_attr *attr, struct blob_attr **data, const struct blob_at
} }
} }
pdata = blob_data(pos);
if (type == BLOB_ATTR_STRING && pdata[len] != 0)
continue;
if (info[id].minlen && len < info[id].minlen) if (info[id].minlen && len < info[id].minlen)
continue; continue;