|
|
a85e8e |
From a990af656571a24156a183dd8a09765e788c3b22 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
Date: Sat, 18 Jan 2014 16:41:47 +0100
|
|
|
a85e8e |
Subject: [PATCH 020/260] * grub-core/kern/efi/efi.c: Ensure that the result
|
|
|
a85e8e |
starts with / and has no //.
|
|
|
a85e8e |
|
|
|
a85e8e |
---
|
|
|
a85e8e |
ChangeLog | 5 +++++
|
|
|
a85e8e |
grub-core/kern/efi/efi.c | 25 +++++++++++++++++--------
|
|
|
a85e8e |
2 files changed, 22 insertions(+), 8 deletions(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a85e8e |
index 6a19f8504..b04a4ef70 100644
|
|
|
a85e8e |
--- a/ChangeLog
|
|
|
a85e8e |
+++ b/ChangeLog
|
|
|
a85e8e |
@@ -1,5 +1,10 @@
|
|
|
a85e8e |
2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
|
|
|
a85e8e |
+ * grub-core/kern/efi/efi.c: Ensure that the result starts with /
|
|
|
a85e8e |
+ and has no //.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
* NEWS: Add few missing entries.
|
|
|
a85e8e |
|
|
|
a85e8e |
2014-01-17 Colin Watson <cjwatson@ubuntu.com>
|
|
|
a85e8e |
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
|
|
a85e8e |
index b253141f2..b9eb1ab1e 100644
|
|
|
a85e8e |
--- a/grub-core/kern/efi/efi.c
|
|
|
a85e8e |
+++ b/grub-core/kern/efi/efi.c
|
|
|
a85e8e |
@@ -309,7 +309,7 @@ grub_efi_modules_addr (void)
|
|
|
a85e8e |
char *
|
|
|
a85e8e |
grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
|
|
a85e8e |
{
|
|
|
a85e8e |
- char *name = 0, *p;
|
|
|
a85e8e |
+ char *name = 0, *p, *pi;
|
|
|
a85e8e |
grub_size_t filesize = 0;
|
|
|
a85e8e |
grub_efi_device_path_t *dp;
|
|
|
a85e8e |
|
|
|
a85e8e |
@@ -328,7 +328,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
|
|
a85e8e |
grub_efi_uint16_t len;
|
|
|
a85e8e |
len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
|
|
a85e8e |
/ sizeof (grub_efi_char16_t));
|
|
|
a85e8e |
- filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 1;
|
|
|
a85e8e |
+ filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2;
|
|
|
a85e8e |
}
|
|
|
a85e8e |
|
|
|
a85e8e |
dp = GRUB_EFI_NEXT_DEVICE_PATH (dp);
|
|
|
a85e8e |
@@ -356,12 +356,12 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
|
|
a85e8e |
grub_efi_file_path_device_path_t *fp;
|
|
|
a85e8e |
grub_efi_uint16_t len;
|
|
|
a85e8e |
|
|
|
a85e8e |
- if (p != name)
|
|
|
a85e8e |
- *p++ = '/';
|
|
|
a85e8e |
+ *p++ = '/';
|
|
|
a85e8e |
|
|
|
a85e8e |
len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
|
|
a85e8e |
/ sizeof (grub_efi_char16_t));
|
|
|
a85e8e |
fp = (grub_efi_file_path_device_path_t *) dp;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len);
|
|
|
a85e8e |
}
|
|
|
a85e8e |
|
|
|
a85e8e |
@@ -370,10 +370,19 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
|
|
a85e8e |
|
|
|
a85e8e |
*p = '\0';
|
|
|
a85e8e |
|
|
|
a85e8e |
- /* EFI breaks paths with backslashes. */
|
|
|
a85e8e |
- for (p = name; *p; p++)
|
|
|
a85e8e |
- if (*p == '\\')
|
|
|
a85e8e |
- *p = '/';
|
|
|
a85e8e |
+ for (pi = name, p = name; *pi;)
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ /* EFI breaks paths with backslashes. */
|
|
|
a85e8e |
+ if (*pi == '\\' || *pi == '/')
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ *p++ = '/';
|
|
|
a85e8e |
+ while (*pi == '\\' || *pi == '/')
|
|
|
a85e8e |
+ pi++;
|
|
|
a85e8e |
+ continue;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ *p++ = *pi++;
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
+ *p = '\0';
|
|
|
a85e8e |
|
|
|
a85e8e |
return name;
|
|
|
a85e8e |
}
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|