[libgtop] Fix alignment issue with proclist arguments unpacking.



commit 4fb241097fd30204ac9a9a661c04618a0a844ace
Author: Benoit Dejean <bdejean gmail com>
Date:   Sun Jun 21 19:15:03 2015 +0200

    Fix alignment issue with proclist arguments unpacking.

 src/daemon/slave.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/daemon/slave.c b/src/daemon/slave.c
index ef5cf4a..1e9004b 100644
--- a/src/daemon/slave.c
+++ b/src/daemon/slave.c
@@ -27,11 +27,12 @@ void
 handle_slave_connection (int input, int output)
 {
        glibtop *server G_GNUC_UNUSED = glibtop_global_server;
-       gint64 *param_ptr G_GNUC_UNUSED;
        const void *ptr G_GNUC_UNUSED;
 
        unsigned short max_len G_GNUC_UNUSED;
        pid_t pid G_GNUC_UNUSED;
+       gint64 proc_which G_GNUC_UNUSED;
+       gint64 proc_arg G_GNUC_UNUSED;
 
        glibtop_response _resp, *resp = &_resp;
        glibtop_command _cmnd, *cmnd = &_cmnd;
@@ -72,10 +73,11 @@ handle_slave_connection (int input, int output)
                        return;
 #if GLIBTOP_SUID_PROCLIST
                case GLIBTOP_CMND_PROCLIST:
-                       param_ptr = (gint64 *) parameter;
+                       memcpy(&proc_which, parameter, sizeof proc_which);
+                       memcpy(&proc_arg, parameter + sizeof proc_which, sizeof proc_arg);
                        ptr = glibtop_get_proclist_p
                                (server, &resp->u.data.proclist,
-                                param_ptr [0], param_ptr [1]);
+                                proc_which, proc_arg);
                        do_output (output, resp, _offset_data (proclist),
                                   resp->u.data.proclist.total, ptr);
                        g_free (ptr);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]