Blame SOURCES/0030-evdev-avoid-bit-vector-decoding-on-non-successful-an.patch

7a62b9
From 7ada13f3a40e2f58aea335cf910666378e7dd99a Mon Sep 17 00:00:00 2001
7a62b9
From: Eugene Syromyatnikov <evgsyr@gmail.com>
7a62b9
Date: Fri, 12 Jul 2019 14:38:33 +0200
7a62b9
Subject: [PATCH 1/3] evdev: avoid bit vector decoding on non-successful and 0
7a62b9
 return codes
7a62b9
7a62b9
Reported by Clang.
7a62b9
7a62b9
    strace/evdev.c:157:3: note: The value 0 is assigned to 'size'
7a62b9
    #                size = tcp->u_rval * 8;
7a62b9
    #                ^~~~~~~~~~~~~~~~~~~~~~
7a62b9
    strace/evdev.c:158:2: warning: Declared variable-length array (VLA)
7a62b9
    has zero size
7a62b9
    #        char decoded_arg[size];
7a62b9
    #        ^
7a62b9
7a62b9
* evdev.c (decode_bitset_): Bail out before decoded_arg VLA definition.
7a62b9
---
7a62b9
 evdev.c | 7 +++++++
7a62b9
 1 file changed, 7 insertions(+)
7a62b9
7a62b9
diff --git a/evdev.c b/evdev.c
7a62b9
index e402d26e..4b811cf8 100644
7a62b9
--- a/evdev.c
7a62b9
+++ b/evdev.c
7a62b9
@@ -155,6 +155,13 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
7a62b9
 		size = max_nr;
7a62b9
 	else
7a62b9
 		size = tcp->u_rval * 8;
7a62b9
+
7a62b9
+	if (syserror(tcp) || !size) {
7a62b9
+		printaddr(arg);
7a62b9
+
7a62b9
+		return RVAL_IOCTL_DECODED;
7a62b9
+	}
7a62b9
+
7a62b9
 	char decoded_arg[size];
7a62b9
 
7a62b9
 	if (umove_or_printaddr(tcp, arg, &decoded_arg))
7a62b9
-- 
7a62b9
2.13.6
7a62b9