]> granicus.if.org Git - strace/commitdiff
prctl: cast arg2 to int in PR_SET_PTRACER handler
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 18 Nov 2016 17:36:21 +0000 (20:36 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 20 Nov 2016 11:32:34 +0000 (11:32 +0000)
Kernel code does this when compares it with -1 (apart from comparing it with
PR_SET_PTRACER_ANY, which is also -1) in security/yama/yama_lsm.c.

* prctl.c (SYS_FUNC(prctl)) <PR_SET_PTRACER>: Cast arg2 to int before
comparing it with -1.

prctl.c

diff --git a/prctl.c b/prctl.c
index e8dd4e819f2664ca8c834c26b96d2b1f8ad6b006..fb2445632c71f7a5e244e9397ae3ffa91f1971d3 100644 (file)
--- a/prctl.c
+++ b/prctl.c
@@ -255,7 +255,7 @@ SYS_FUNC(prctl)
 
        case PR_SET_PTRACER:
                tprints(", ");
-               if (arg2 == -1)
+               if ((int) arg2 == -1)
                        tprints("PR_SET_PTRACER_ANY");
                else
                        tprintf("%llu", arg2);