summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-12-21 16:16:40 +1100
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-12-21 16:16:40 +1100
commitb3d51f6ec5d077e6a2068fde0631074a7302b1da (patch)
tree70051b0015702c4893670584c4a8d7ceb9c9929d /lib/pb-protocol
parentf155a58a64c660e46e74123293482561b816a39a (diff)
downloadpetitboot-b3d51f6ec5d077e6a2068fde0631074a7302b1da.zip
petitboot-b3d51f6ec5d077e6a2068fde0631074a7302b1da.tar.gz
lib/pb-protocol: Fix NULL dereference on non-powerpc
If not running on a powerpc platform the bmc_mac pointer remains NULL. If this is the case set an address of zero when serialising rather than dereferencing the pointer. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r--lib/pb-protocol/pb-protocol.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 9d07a58..42506e2 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -424,7 +424,10 @@ int pb_protocol_serialise_system_info(const struct system_info *sysinfo,
pos += pb_protocol_serialise_string(pos, bd_info->mountpoint);
}
- memcpy(pos, sysinfo->bmc_mac, HWADDR_SIZE);
+ if (sysinfo->bmc_mac)
+ memcpy(pos, sysinfo->bmc_mac, HWADDR_SIZE);
+ else
+ memset(pos, 0, HWADDR_SIZE);
pos += HWADDR_SIZE;
assert(pos <= buf + buf_len);
OpenPOWER on IntegriCloud