From 94a4865c0c4257196827ef426150026980d4a10b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 27 Mar 2017 10:30:23 +0200 Subject: termios: Avoid invalid memory access Update #2897. --- cpukit/libcsupport/src/termios.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index a7944ecc1e..6557135125 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -847,7 +847,7 @@ rtems_termios_ioctl (void *arg) struct rtems_termios_tty *tty = args->iop->data1; struct ttywakeup *wakeup = (struct ttywakeup *)args->buffer; rtems_status_code sc; - int flags = *((int *)args->buffer); + int flags; args->ioctl_return = 0; sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); @@ -920,6 +920,8 @@ rtems_termios_ioctl (void *arg) break; case TIOCFLUSH: + flags = *((int *)args->buffer); + if (flags == 0) { flags = FREAD | FWRITE; } else { -- cgit v1.2.3