From a734a97d0e02bfea3625a60d8d1d114555a925ed Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 16 May 2016 21:57:08 +0000 Subject: [PATCH] Fix printing of invalid l_type and l_whence in fcntl/fcntl64 syscalls * fcntl.c (print_struct_flock64): Explicitly cast l_type and l_whence fields to unsigned short to avoid potential sign-extension bug when printing invalid l_type or l_whence fields. --- fcntl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fcntl.c b/fcntl.c index 59eca9db..e446a1c6 100644 --- a/fcntl.c +++ b/fcntl.c @@ -43,9 +43,9 @@ static void print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk) { tprints("{l_type="); - printxval(lockfcmds, fl->l_type, "F_???"); + printxval(lockfcmds, (unsigned short) fl->l_type, "F_???"); tprints(", l_whence="); - printxval(whence_codes, fl->l_whence, "SEEK_???"); + printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???"); tprintf(", l_start=%lld, l_len=%lld", (long long) fl->l_start, (long long) fl->l_len); if (getlk) -- 2.40.0