From: Andreas Reichel <[email protected]> A user variable can be set to an empty string or it can be deleted. The API distinguishes both cases using a USERVAR_TYPE_DELETED flag.
However, if a variable does not exist, and this flag is given, the variable is wrongly created with the flag. Fix the setter function so that if bgenv_find_uservar returns NULL, it returns with no operation. Signed-off-by: Andreas Reichel <[email protected]> --- env/uservars.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/env/uservars.c b/env/uservars.c index 02ed1d2..4952624 100644 --- a/env/uservars.c +++ b/env/uservars.c @@ -140,7 +140,11 @@ int bgenv_set_uservar(uint8_t *udata, char *key, uint64_t type, void *data, p = bgenv_uservar_realloc(udata, total_size, p); } else { - p = bgenv_uservar_alloc(udata, total_size); + if ((type & USERVAR_TYPE_DELETED) == 0) { + p = bgenv_uservar_alloc(udata, total_size); + } else { + return 0; + } } if (!p) { return -errno; -- 2.15.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20171114132044.1907-4-andreas.reichel.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.
