iot/zoap: Fix decoding of 16-bit delta

When an option code or length representation is encoded in a 16-bit
value, the access was wrong.

Coverity-CID: 151963

Change-Id: Ie7741998cbde348ccf490a6686e68a1ace99920e
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
This commit is contained in:
Vinicius Costa Gomes 2016-11-18 17:47:06 -02:00 committed by Anas Nashif
commit 777d57dbfb

View file

@ -78,7 +78,7 @@ static int decode_delta(int num, const uint8_t *buf, int16_t buflen,
return -EINVAL;
}
num = sys_be16_to_cpu((uint16_t)*buf) + 269;
num = sys_get_be16(buf) + 269;
hdrlen += 2;
break;
case 15: