7ca40a8 stub: Fix cmdline handling

7 files Authored by Jan Janssen a year ago, Committed by zbyszek a year ago,
     stub: Fix cmdline handling
    
    This fixes some bugs that could lead to garbage getting appended to the
    command line passed to the kernel:
     1. The .cmdline section is not guaranteed to be NUL-terminated, but it
        was used as if it was.
     2. The conversion of the command line to ASCII that was passed to the
        stub ate the NUL at the end.
     3. LoadOptions is not guaranteed to be a NUL-terminated EFI string (it
        really should be and generally always is, though).
    
    This also fixes the inconsistent mangling of the command line. If the
    .cmdline section was used ASCII controls chars (new lines in particular)
    would not be converted to spaces.
    
    As part of this commit, we optimize conversion for the generic code
    instead of the (deprecated) EFI handover protocol. Previously we would
    convert to ASCII/UTF-8 and then back to EFI string for the (now) default
    generic code path. Instead we now convert to EFI string and mangle that
    back to ASCII in the EFI handover protocol path.
    
    (cherry picked from commit 927ebebe588970fa2dd082a0daaef246229f009b)
    
        
file modified
+4 -6
file modified
+6 -6
file modified
+11 -6
file modified
+14 -7
file modified
+17 -21
file modified
+7 -0
file modified
+1 -0