diff options
author | William A. Kennington III <wak@google.com> | 2018-01-24 15:12:21 -0800 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2018-01-29 11:42:49 +0000 |
commit | e73d15d5f5ea12ff94afb77c1e7f1867bd4c5acf (patch) | |
tree | 0f9f26112f8946d235a7a745bfe40e9641ecb9c1 | |
parent | 3b76e3756edf54ece1b4059d193b65bb2769d22e (diff) | |
download | phosphor-host-ipmid-e73d15d5f5ea12ff94afb77c1e7f1867bd4c5acf.tar.gz phosphor-host-ipmid-e73d15d5f5ea12ff94afb77c1e7f1867bd4c5acf.zip |
watchdog: Fix enabled value type
When deserializing a bool with sd_bus_message_read, it expects the
storage of the passed in container to be 4 bytes. A bool is not
guaranteed to be this large and will cause sd_bus_message_read to
scribble on the stack. Change enabled to int to guarantee enough
space to deserialize the result.
For reference libsystemd is doing:
*(int*) p = !!*(uint8_t*) q;
Change-Id: Ic299e303fcb70941757c453a7b4f643337220afb
Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r-- | app/watchdog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/watchdog.cpp b/app/watchdog.cpp index 7b04faa..da83ca3 100644 --- a/app/watchdog.cpp +++ b/app/watchdog.cpp @@ -125,7 +125,7 @@ ipmi_ret_t ipmi_app_reset_watchdog( char *busname = NULL; // Current properties of the watchdog daemon. - bool enabled = false; + int enabled = 0; uint64_t interval = 0; // Status code. |