0010-Use-alloca-when-VLAs-aren-t-available.patch (824B)
1 From 4673bf0d6a0eba5d363266a40cfb087e08a66e7f Mon Sep 17 00:00:00 2001 2 From: Michael Forney <mforney@mforney.org> 3 Date: Thu, 30 Jan 2020 21:57:34 -0800 4 Subject: [PATCH] Use alloca when VLAs aren't available 5 6 --- 7 src/evdev.c | 6 +++++- 8 1 file changed, 5 insertions(+), 1 deletion(-) 9 10 diff --git a/src/evdev.c b/src/evdev.c 11 index 81dd951cb..74a765469 100644 12 --- a/src/evdev.c 13 +++ b/src/evdev.c 14 @@ -164,9 +164,13 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg, 15 return RVAL_IOCTL_DECODED; 16 } 17 18 +#ifndef __STDC_NO_VLA__ 19 char decoded_arg[size]; 20 +#else 21 + char *decoded_arg = alloca(size); 22 +#endif 23 24 - if (umove_or_printaddr(tcp, arg, &decoded_arg)) 25 + if (umoven_or_printaddr(tcp, arg, size, decoded_arg)) 26 return RVAL_IOCTL_DECODED; 27 28 if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_RAW) { 29 -- 30 2.34.1 31