summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--futility/cmd_gbb_utility.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/futility/cmd_gbb_utility.c b/futility/cmd_gbb_utility.c
index 9810058d..85b47829 100644
--- a/futility/cmd_gbb_utility.c
+++ b/futility/cmd_gbb_utility.c
@@ -342,6 +342,9 @@ static int read_from_file(const char *msg, const char *filename,
goto done_close;
}
+ /* Wipe existing data. */
+ memset(start, 0, size);
+
/* It's okay if we read less than size. That's just the max. */
count = fread(start, 1, size, fp);
if (ferror(fp)) {
@@ -568,6 +571,9 @@ static int do_gbb_utility(int argc, char *argv[])
gbb->hwid_size);
errorcnt++;
} else {
+ /* Wipe data before writing new value. */
+ memset(gbb_base + gbb->hwid_offset, 0,
+ gbb->hwid_size);
strcpy((char *)(gbb_base + gbb->hwid_offset),
opt_hwid);
}