From 087832fd1a97949ac620e976ffa932bda09366a6 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Thu, 22 Dec 2022 12:55:05 +0700 Subject: [PATCH] Fix undefined-shift in STUN message check (#3313) --- pjnath/src/pjnath/stun_msg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pjnath/src/pjnath/stun_msg.c b/pjnath/src/pjnath/stun_msg.c index e904a0ba47..c6b0bdd284 100644 --- a/pjnath/src/pjnath/stun_msg.c +++ b/pjnath/src/pjnath/stun_msg.c @@ -750,8 +750,8 @@ PJ_DEF(int) pj_stun_set_padding_char(int chr) static pj_uint16_t GETVAL16H(const pj_uint8_t *buf, unsigned pos) { - return (pj_uint16_t) ((buf[pos + 0] << 8) | \ - (buf[pos + 1] << 0)); + return (pj_uint16_t) (((pj_uint16_t)buf[pos + 0] << 8) | \ + ((pj_uint16_t)buf[pos + 1] << 0)); } /*unused PJ_INLINE(pj_uint16_t) GETVAL16N(const pj_uint8_t *buf, unsigned pos) @@ -767,10 +767,10 @@ static void PUTVAL16H(pj_uint8_t *buf, unsigned pos, pj_uint16_t hval) PJ_INLINE(pj_uint32_t) GETVAL32H(const pj_uint8_t *buf, unsigned pos) { - return (pj_uint32_t) ((buf[pos + 0] << 24UL) | \ - (buf[pos + 1] << 16UL) | \ - (buf[pos + 2] << 8UL) | \ - (buf[pos + 3] << 0UL)); + return (pj_uint32_t) (((pj_uint32_t)buf[pos + 0] << 24UL) | \ + ((pj_uint32_t)buf[pos + 1] << 16UL) | \ + ((pj_uint32_t)buf[pos + 2] << 8UL) | \ + ((pj_uint32_t)buf[pos + 3] << 0UL)); } /*unused PJ_INLINE(pj_uint32_t) GETVAL32N(const pj_uint8_t *buf, unsigned pos)