From 777d57dbfb8cfed73331135c88f6754c1c6b4dfc Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Fri, 18 Nov 2016 17:47:06 -0200 Subject: [PATCH] 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 --- lib/iot/zoap/zoap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iot/zoap/zoap.c b/lib/iot/zoap/zoap.c index 2e2d90d9e5f..9b8990655c9 100644 --- a/lib/iot/zoap/zoap.c +++ b/lib/iot/zoap/zoap.c @@ -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: