From bc72527a1426c2159112707d3a6c9bb544fd6647 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 7 Apr 2014 15:22:46 +0800 Subject: [PATCH 1/1] lib/pb-protocol: fix deserialise of boot option priorities Commit aa530148 introduced a priority member to struct boot_priority, but didn't update the protocol deserialise function to properly decode config messages. This meant we were leaving half of the struct uninitialised, and getting invalid values in the initialised part. This change updates the config deserialise function to do proper handling for boot priority data. Signed-off-by: Jeremy Kerr --- lib/pb-protocol/pb-protocol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 3c472fe..cf27b8e 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -890,6 +890,9 @@ int pb_protocol_deserialise_config(struct config *config, config->n_boot_priorities); for (i = 0; i < config->n_boot_priorities; i++) { + if (read_u32(&pos, &len, &tmp)) + goto out; + config->boot_priorities[i].priority = (int)tmp; if (read_u32(&pos, &len, &tmp)) goto out; config->boot_priorities[i].type = tmp; -- 2.39.2