summaryrefslogtreecommitdiffstats
path: root/lib/pb-config
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-07-02 10:47:35 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-07-02 11:44:20 +0800
commit885d734b203d44b6e5537cd1d1dd1ff117efba8c (patch)
tree2eb74b2866aeb3663744c9ea82d109d0a39d63c7 /lib/pb-config
parent4a9725bb74e7a05731eff0b9166c4d1e99b7064d (diff)
downloadtalos-petitboot-885d734b203d44b6e5537cd1d1dd1ff117efba8c.tar.gz
talos-petitboot-885d734b203d44b6e5537cd1d1dd1ff117efba8c.zip
config/powerpc-nvram: Fix nvram line parsing
We have a couple of issues with the nvram output parser; lines aren't being broken up correctly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/pb-config')
-rw-r--r--lib/pb-config/storage-powerpc-nvram.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/pb-config/storage-powerpc-nvram.c b/lib/pb-config/storage-powerpc-nvram.c
index 96d279c..4b16479 100644
--- a/lib/pb-config/storage-powerpc-nvram.c
+++ b/lib/pb-config/storage-powerpc-nvram.c
@@ -78,9 +78,16 @@ static int parse_nvram_params(struct powerpc_nvram_storage *nv,
return -1;
}
- for (pos = buf + i; pos < buf + len; pos += paramlen) {
+ for (pos = buf + i; pos < buf + len; pos += paramlen + 1) {
unsigned int namelen;
struct param *param;
+ char *newline;
+
+ newline = strchr(pos, '\n');
+ if (!newline)
+ break;
+
+ *newline = '\0';
paramlen = strlen(pos);
@@ -89,7 +96,9 @@ static int parse_nvram_params(struct powerpc_nvram_storage *nv,
if (!value)
continue;
- namelen = name - value;
+ namelen = value - name;
+ if (namelen == 0)
+ continue;
if (!param_is_known(name, namelen))
continue;
OpenPOWER on IntegriCloud