summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-04-24 14:44:03 -0700
committerWilliam A. Kennington III <wak@google.com>2019-04-29 12:06:35 -0700
commit906e0f802b56d26e7e0c65eba797fa8a596dee91 (patch)
treebce270b5f95f2893c1596fd2fdb3c8578465d612 /include
parentd10d90563e58606964fe3b8460eed2ca719527e5 (diff)
downloadphosphor-host-ipmid-906e0f802b56d26e7e0c65eba797fa8a596dee91.tar.gz
phosphor-host-ipmid-906e0f802b56d26e7e0c65eba797fa8a596dee91.zip
message/pack: Check for outstanding bits
Currently, if you pack a non-byte aligned member into a message and then pack an array, it will do the wrong thing and treat the unaligned data as being appended to the end of the message. Allowing for this behavior is convoluted and probably not useful, so just return an error. Change-Id: I6f200dbea96c41f49a110ba7536ccfd37115d277 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/ipmid/message/pack.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 18863c4..deb0a5a 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -239,6 +239,10 @@ struct PackSingle<std::vector<uint8_t>>
{
static int op(Payload& p, const std::vector<uint8_t>& t)
{
+ if (p.bitCount != 0)
+ {
+ return 1;
+ }
p.raw.reserve(p.raw.size() + t.size());
p.raw.insert(p.raw.end(), t.begin(), t.end());
return 0;
OpenPOWER on IntegriCloud