1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-24 06:04:05 +03:00

efi: fix mangle_stub_cmdline() for empty strings

This commit is contained in:
Lennart Poettering 2024-07-02 16:01:28 +02:00
parent 596731db99
commit d30b89c7fc

View File

@ -42,19 +42,17 @@ static bool shall_be_whitespace(char16_t c) {
}
char16_t* mangle_stub_cmdline(char16_t *cmdline) {
char16_t *p, *q, *e;
if (!cmdline)
return cmdline;
p = q = cmdline;
/* Skip initial whitespace */
while (shall_be_whitespace(*p))
const char16_t *p = cmdline;
while (*p != 0 && shall_be_whitespace(*p))
p++;
/* Turn inner control characters into proper spaces */
for (e = p; *p != 0; p++) {
char16_t *e = cmdline;
for (char16_t *q = cmdline; *p != 0; p++) {
if (shall_be_whitespace(*p)) {
*(q++) = ' ';
continue;