]> granicus.if.org Git - strace/commitdiff
process_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 14 Oct 2016 23:54:39 +0000 (02:54 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 28 Oct 2016 18:40:11 +0000 (18:40 +0000)
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Use widen_to_ulong for local_iovcnt,
renote_iovcnt, and flags parameters.

process_vm.c

index 9e52c6c52eed2038ca529e36f8ce21c2892d77db..b0bade72f7f9966c6f8fe22d19a445d5e41de8a9 100644 (file)
@@ -34,35 +34,43 @@ SYS_FUNC(process_vm_readv)
                /* arg 1: pid */
                tprintf("%d, ", (int) tcp->u_arg[0]);
        } else {
+               unsigned long local_iovcnt = widen_to_ulong(tcp->u_arg[2]);
+               unsigned long remote_iovcnt = widen_to_ulong(tcp->u_arg[4]);
+               unsigned long flags = widen_to_ulong(tcp->u_arg[5]);
+
                /* arg 2: local iov */
-               tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
+               tprint_iov_upto(tcp, local_iovcnt, tcp->u_arg[1],
                           syserror(tcp) ? IOV_DECODE_ADDR : IOV_DECODE_STR,
                           tcp->u_rval);
                /* arg 3: local iovcnt */
-               tprintf(", %lu, ", tcp->u_arg[2]);
+               tprintf(", %lu, ", local_iovcnt);
                /* arg 4: remote iov */
-               tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3],
+               tprint_iov(tcp, remote_iovcnt, tcp->u_arg[3],
                           IOV_DECODE_ADDR);
                /* arg 5: remote iovcnt */
                /* arg 6: flags */
-               tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]);
+               tprintf(", %lu, %lu", remote_iovcnt, flags);
        }
        return 0;
 }
 
 SYS_FUNC(process_vm_writev)
 {
+       unsigned long local_iovcnt = widen_to_ulong(tcp->u_arg[2]);
+       unsigned long remote_iovcnt = widen_to_ulong(tcp->u_arg[4]);
+       unsigned long flags = widen_to_ulong(tcp->u_arg[5]);
+
        /* arg 1: pid */
        tprintf("%d, ", (int) tcp->u_arg[0]);
        /* arg 2: local iov */
-       tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
+       tprint_iov(tcp, local_iovcnt, tcp->u_arg[1], IOV_DECODE_STR);
        /* arg 3: local iovcnt */
-       tprintf(", %lu, ", tcp->u_arg[2]);
+       tprintf(", %lu, ", local_iovcnt);
        /* arg 4: remote iov */
-       tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], IOV_DECODE_ADDR);
+       tprint_iov(tcp, remote_iovcnt, tcp->u_arg[3], IOV_DECODE_ADDR);
        /* arg 5: remote iovcnt */
        /* arg 6: flags */
-       tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]);
+       tprintf(", %lu, %lu", remote_iovcnt, flags);
 
        return RVAL_DECODED;
 }