improve validation - add header length

This commit is contained in:
Felix Fietkau 2011-01-23 20:32:57 +01:00
parent fcee2d56bc
commit 5e5abe33fe

View file

@ -26,7 +26,7 @@ bool blobmsg_check_attr(const struct blob_attr *attr, bool name)
if (!hdr->namelen && name) if (!hdr->namelen && name)
return false; return false;
if (hdr->namelen > blob_len(attr)) if (hdr->namelen > blob_len(attr) - sizeof(struct blobmsg_hdr))
return false; return false;
if (hdr->name[hdr->namelen] != 0) if (hdr->name[hdr->namelen] != 0)