/* Unpacks binary string from the buffer from the offset requested.  */
static int unpack_data(uint32_t length, struct buf_ctx *buf, struct mqtt_binstr *str)
/* Unpacks binary string from the buffer from the offset requested.  */
static int unpack_data(uint32_t length, struct buf_ctx *buf, struct mqtt_binstr *str)
{
	NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end);
	if ((buf->end - buf->cur) < length) {
		return -EINVAL;
	}
	str->len = length;
	if (length > 0) {
		str->data = buf->cur;
		buf->cur += length;
	} else {
		str->data = NULL;
	}
	NET_DBG("<< bin len:%08x", GET_BINSTR_BUFFER_SIZE(str));
	return 0;
}