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

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