aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-01-05 07:09:09 +0000
committerWarner Losh <imp@FreeBSD.org>2018-01-05 07:09:09 +0000
commitda15338df85f838c761aad158eb8dd6e7bf29f86 (patch)
tree91eb638d6f0795ce333cdad9775aec405c838d0c
parent53584cf69cafbb96a15c374aba625786ea1f3ddb (diff)
downloadsrc-da15338df85f838c761aad158eb8dd6e7bf29f86.tar.gz
src-da15338df85f838c761aad158eb8dd6e7bf29f86.zip
Ensure that we have a description string. When unspecified, default to "".
Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=327572
-rw-r--r--usr.sbin/efibootmgr/efibootmgr.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c
index 20f9e1dbc5a7..c44edb3e8a1d 100644
--- a/usr.sbin/efibootmgr/efibootmgr.c
+++ b/usr.sbin/efibootmgr/efibootmgr.c
@@ -591,12 +591,7 @@ create_loadopt(uint8_t *buf, size_t bufmax, uint32_t attributes, efidp dp, size_
/*
* Compute the length to make sure the passed in buffer is long enough.
*/
- if (description)
- utf8_to_ucs2(description, &bbuf, &desc_len);
- else {
- desc_len = 0;
- bbuf = NULL;
- }
+ utf8_to_ucs2(description, &bbuf, &desc_len);
len = sizeof(uint32_t) + sizeof(uint16_t) + desc_len + dp_size + optional_data_size;
if (len > bufmax) {
free(bbuf);
@@ -636,6 +631,8 @@ make_boot_var(const char *label, const char *loader, const char *kernel, const c
char *bootvar = NULL;
int ret;
+ assert(label != NULL);
+
bootvar = make_next_boot_var_name();
if (bootvar == NULL)
err(1, "bootvar creation");
@@ -755,7 +752,7 @@ print_loadopt_str(uint8_t *data, size_t datalen)
}
static char *
-get_descr(uint8_t* data)
+get_descr(uint8_t *data)
{
uint8_t *pos = data;
efi_char *desc;
@@ -861,8 +858,8 @@ main(int argc, char *argv[])
/*
* side effect, adds to boot order, but not yet active.
*/
- make_boot_var(opts.label, opts.loader, opts.kernel, opts.env,
- opts.dry_run);
+ make_boot_var(opts.label ? opts.label : "",
+ opts.loader, opts.kernel, opts.env, opts.dry_run);
else if (opts.set_active || opts.set_inactive )
handle_activity(opts.bootnum, opts.set_active);
else if (opts.order != NULL)