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

sock.c

diff --git a/sock.c b/sock.c
index 88a0df53ece8b18ac010b277795abe86d7f5ca73..c948294697810a09ffd82833a5fd4716e12ef231 100644 (file)
--- a/sock.c
+++ b/sock.c
@@ -97,7 +97,7 @@ print_ifreq(struct tcb *tcp, const unsigned int code, const long arg,
        case SIOCSIFFLAGS:
        case SIOCGIFFLAGS:
                tprints("ifr_flags=");
-               printflags(iffflags, ifr->ifr_flags, "IFF_???");
+               printflags(iffflags, (unsigned short) ifr->ifr_flags, "IFF_???");
                break;
        case SIOCSIFMETRIC:
        case SIOCGIFMETRIC: