summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ipmid/message/pack.hpp4
-rw-r--r--test/message/pack.cpp7
2 files changed, 11 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;
diff --git a/test/message/pack.cpp b/test/message/pack.cpp
index d0a738a..7e6cf31 100644
--- a/test/message/pack.cpp
+++ b/test/message/pack.cpp
@@ -235,6 +235,13 @@ TEST(PackBasics, VectorUint8)
ASSERT_EQ(p.raw, k);
}
+TEST(PackBasics, VectorUnaligned)
+{
+ ipmi::message::Payload p;
+ EXPECT_EQ(p.pack(true, std::vector<uint8_t>{1}), 1);
+ EXPECT_EQ(p.raw, std::vector<uint8_t>{0b1});
+}
+
TEST(PackBasics, OptionalEmpty)
{
// an optional will only pack if the value is present
OpenPOWER on IntegriCloud