Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot utf8_to_ucs2 second param (nmp) needs to b...



details:   https://anonhg.NetBSD.org/src/rev/cf2504192bfd
branches:  trunk
changeset: 433521:cf2504192bfd
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Sep 18 19:19:45 2018 +0000

description:
utf8_to_ucs2 second param (nmp) needs to be initialized before calling this function

diffstat:

 sys/stand/efiboot/efienv.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r 7618d77f6f4f -r cf2504192bfd sys/stand/efiboot/efienv.c
--- a/sys/stand/efiboot/efienv.c        Tue Sep 18 14:57:32 2018 +0000
+++ b/sys/stand/efiboot/efienv.c        Tue Sep 18 19:19:45 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efienv.c,v 1.1 2018/09/09 17:55:22 jmcneill Exp $ */
+/* $NetBSD: efienv.c,v 1.2 2018/09/18 19:19:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -39,16 +39,12 @@
 {
        EFI_STATUS status;
        CHAR16 *ukey;
-       char *data;
        size_t len;
 
-       data = AllocatePool(strlen(val) + 1);
-       strcpy(data, val);
-
+       ukey = NULL;
        utf8_to_ucs2(key, &ukey, &len);
-       status = LibSetNVVariable(ukey, &EfibootVendorGuid, strlen(data) + 1, data);
+       status = LibSetNVVariable(ukey, &EfibootVendorGuid, strlen(val) + 1, val);
        FreePool(ukey);
-       FreePool(data);
 
        if (EFI_ERROR(status))
                printf("env: failed to set variable '%s': %#lx\n", key, status);
@@ -61,6 +57,7 @@
        size_t len;
        char *ret;
 
+       ukey = NULL;
        utf8_to_ucs2(key, &ukey, &len);
        ret = LibGetVariable(ukey, &EfibootVendorGuid);
        FreePool(ukey);
@@ -74,6 +71,7 @@
        CHAR16 *ukey;
        size_t len;
 
+       ukey = NULL;
        utf8_to_ucs2(key, &ukey, &len);
        LibDeleteVariable(ukey, &EfibootVendorGuid);
        FreePool(ukey);



Home | Main Index | Thread Index | Old Index