From e86d9e52075e2edd37fe497b0d11a2df3fd1df31 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Thu, 9 Apr 2015 21:27:56 +0100 Subject: [PATCH] ioport: Don't deref NULL on bad param that ioctl requires a parameter, but doesn't check it. Static analyzer doesn't like that at all. Signed-off-by: Michel Pollet --- simavr/sim/avr_ioport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c index 19c9948..14fabce 100644 --- a/simavr/sim/avr_ioport.c +++ b/simavr/sim/avr_ioport.c @@ -168,6 +168,10 @@ avr_ioport_ioctl( avr_ioport_t * p = (avr_ioport_t *)port; avr_t * avr = p->io.avr; int res = -1; + + // all IOCTls require some sort of valid parameter, bail if not + if (!io_param) + return -1; switch(ctl) { case AVR_IOCTL_IOPORT_GETIRQ_REGBIT: { -- 2.39.5