Blame SOURCES/0005-websocket-Fix-possible-integer-overflow.patch

ec2abb
From b8f4d7d2c7a3d08a82f4bc7588cdff15cee54292 Mon Sep 17 00:00:00 2001
ec2abb
From: Frediano Ziglio <freddy77@gmail.com>
ec2abb
Date: Tue, 16 Jun 2020 11:49:19 +0100
ec2abb
Subject: [PATCH] websocket: Fix possible integer overflow
ec2abb
ec2abb
The shift of a uint_8 number by a number > 32 causes an overflow.
ec2abb
ec2abb
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
ec2abb
Acked-by: Uri Lublin <ulublin@redhat.com>
ec2abb
---
ec2abb
 server/websocket.c | 5 +++--
ec2abb
 1 file changed, 3 insertions(+), 2 deletions(-)
ec2abb
ec2abb
diff --git a/server/websocket.c b/server/websocket.c
ec2abb
index f5df63f8..82b20b49 100644
ec2abb
--- a/server/websocket.c
ec2abb
+++ b/server/websocket.c
ec2abb
@@ -165,8 +165,9 @@ static uint64_t extract_length(const uint8_t *buf, int *used)
ec2abb
     case LENGTH_64BIT:
ec2abb
         *used += 8;
ec2abb
         outlen = 0;
ec2abb
-        for (i = 56; i >= 0; i -= 8) {
ec2abb
-            outlen |= (*buf++) << i;
ec2abb
+        for (i = 0; i < 8; ++i) {
ec2abb
+            outlen <<= 8;
ec2abb
+            outlen |= *buf++;
ec2abb
         }
ec2abb
         break;
ec2abb
 
ec2abb
-- 
ec2abb
2.26.2
ec2abb