From: Michel Pollet Date: Thu, 9 Apr 2015 20:27:56 +0000 (+0100) Subject: ioport: Don't deref NULL on bad param X-Git-Tag: v1.3~52 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=e86d9e52075e2edd37fe497b0d11a2df3fd1df31;p=sx%2Fsimavr.git 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 --- 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: {