]> granicus.if.org Git - strace/blobdiff - signal.c
Robustify mpers.awk against invalid input
[strace] / signal.c
index 978926fbdc96665a4847d746bd0d7e5bdcf2d489..ec1684ef82ecd6623982ad584c6076e470555519 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -633,7 +633,7 @@ print_sigqueueinfo(struct tcb *tcp, int sig, unsigned long uinfo)
 {
        printsignal(sig);
        tprints(", ");
-       MPERS_PRINTER_NAME(printsiginfo_at)(tcp, uinfo);
+       printsiginfo_at(tcp, uinfo);
 }
 
 SYS_FUNC(rt_sigqueueinfo)
@@ -666,14 +666,23 @@ SYS_FUNC(rt_sigtimedwait)
        }
        else if (tcp->u_arg[1] != 0) {
                /* syscall exit, and u_arg[1] wasn't NULL */
-               MPERS_PRINTER_NAME(printsiginfo_at)(tcp, tcp->u_arg[1]);
+               printsiginfo_at(tcp, tcp->u_arg[1]);
                tprints(", ");
        }
        else {
                /* syscall exit, and u_arg[1] was NULL */
                return 0;
        }
+
+       /*
+        * Since the timeout parameter is read by the kernel
+        * on entering syscall, it has to be decoded the same way
+        * whether the syscall has failed or not.
+        */
+       temporarily_clear_syserror(tcp);
        print_timespec(tcp, tcp->u_arg[2]);
+       restore_cleared_syserror(tcp);
+
        tprintf(", %lu", tcp->u_arg[3]);
        return 0;
 };