Signed-off-by: John Crispin <john@phrozen.org>
int i;
memset(tb, 0, policy_len * sizeof(*tb));
+ if (!data || !len)
+ return -EINVAL;
pslen = alloca(policy_len);
for (i = 0; i < policy_len; i++) {
if (!policy[i].name)
static inline void *blobmsg_data(const struct blob_attr *attr)
{
- struct blobmsg_hdr *hdr = (struct blobmsg_hdr *) blob_data(attr);
- char *data = (char *) blob_data(attr);
+ struct blobmsg_hdr *hdr;
+ char *data;
+
+ if (!attr)
+ return NULL;
+
+ hdr = (struct blobmsg_hdr *) blob_data(attr);
+ data = (char *) blob_data(attr);
if (blob_is_extended(attr))
data += blobmsg_hdrlen(be16_to_cpu(hdr->namelen));
{
uint8_t *start, *end;
+ if (!attr)
+ return 0;
+
start = (uint8_t *) blob_data(attr);
end = (uint8_t *) blobmsg_data(attr);