Commit e86d9e52075e2edd37fe497b0d11a2df3fd1df31
authorMichel Pollet <buserror@gmail.com>
Thu, 9 Apr 2015 20:27:56 +0000 (21:27 +0100)
committerMichel Pollet <buserror@gmail.com>
Thu, 9 Apr 2015 20:27:56 +0000 (21:27 +0100)
that ioctl requires a parameter, but doesn't check it. Static analyzer
doesn't like that at all.

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/avr_ioport.c

index 19c994835c2b284e71d30ba6538cb61205b11dab..14fabce2437056867ecf623b3ac7b279395829c9 100644 (file)
@@ -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: {