All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_loader: fix device path to text protocol
@ 2022-01-29 18:06 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2022-01-29 18:06 UTC (permalink / raw)
  To: u-boot; +Cc: Heinrich Schuchardt

File device path nodes may contain non-ASCII characters. Correctly
truncate the text if it does not fit into the buffer.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_loader/efi_device_path_to_text.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c
index d8a83c8849..805add7268 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -292,10 +292,7 @@ static char *dp_media(char *s, struct efi_device_path *dp)
 	case DEVICE_PATH_SUB_TYPE_FILE_PATH: {
 		struct efi_device_path_file_path *fp =
 			(struct efi_device_path_file_path *)dp;
-		int slen = (dp->length - sizeof(*dp)) / 2;
-		if (slen > MAX_NODE_LEN - 2)
-			slen = MAX_NODE_LEN - 2;
-		s += sprintf(s, "%-.*ls", slen, fp->str);
+		s += snprintf(s, MAX_NODE_LEN, "%ls", fp->str);
 		break;
 	}
 	default:
-- 
2.33.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-29 18:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-29 18:06 [PATCH 1/1] efi_loader: fix device path to text protocol Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.