]> granicus.if.org Git - strace/commitdiff
Fix printing of invalid struct pollfd.events
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:03:51 +0000 (22:03 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:41:19 +0000 (22:41 +0000)
* poll.c (print_pollfd): Explicitly cast struct pollfd.events
to unsigned short to avoid potential sign-extension bug when printing
invalid struct pollfd.events.

poll.c

diff --git a/poll.c b/poll.c
index f116cef056ea617a168a786a829ad4856f87417b..b66c46d8a0019a7d854166c15a741fef1b4ed6ac 100644 (file)
--- a/poll.c
+++ b/poll.c
@@ -40,7 +40,7 @@ print_pollfd(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
        printfd(tcp, fds->fd);
        if (fds->fd >= 0) {
                tprints(", events=");
-               printflags(pollflags, fds->events, "POLL???");
+               printflags(pollflags, (unsigned short) fds->events, "POLL???");
        }
        tprints("}");