From 8255810bab2d07b6335da67c65f5bca736f2c14b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Tue, 10 Oct 2017 13:24:52 +0200
Subject: [PATCH] cbor: fix integer overflow in decode_bytes

---
 sys/cbor/cbor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/cbor/cbor.c b/sys/cbor/cbor.c
index a1aa5affea..05a918cd38 100644
--- a/sys/cbor/cbor.c
+++ b/sys/cbor/cbor.c
@@ -400,7 +400,7 @@ static size_t decode_bytes(const cbor_stream_t *s, size_t offset, char *out, siz
         return 0;
     }
 
-    if (length < bytes_length + 1) {
+    if (bytes_length == SIZE_MAX || length < bytes_length + 1) {
         return 0;
     }
 
-- 
GitLab