X-Git-Url: http://git.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=blobmsg.h;fp=blobmsg.h;h=e9e0e6e08ed4c0a03eee3a54accdf5f83fd7c052;hp=4619643e27d6c97b19878d3cfcaee65fef4e68fa;hb=58aec3c59a53147c7d924c823f7405218fb5f555;hpb=926121113b903bf7b6133f782c84d0ed6c1a1a58 diff --git a/blobmsg.h b/blobmsg.h index 4619643..e9e0e6e 100644 --- a/blobmsg.h +++ b/blobmsg.h @@ -65,7 +65,12 @@ static inline int blobmsg_type(const struct blob_attr *attr) static inline void *blobmsg_data(const struct blob_attr *attr) { struct blobmsg_hdr *hdr = (struct blobmsg_hdr *) blob_data(attr); - return (char *) hdr + blobmsg_hdrlen(be16_to_cpu(hdr->namelen)); + char *data = blob_data(attr); + + if (blob_is_extended(attr)) + data += blobmsg_hdrlen(be16_to_cpu(hdr->namelen)); + + return data; } static inline int blobmsg_data_len(const struct blob_attr *attr)