8c6b1ac71e
Also include some minor fixes for gcc 5.1.1 Signed-off-by: Peter Jones <pjones@redhat.com>
36 lines
1.2 KiB
Diff
36 lines
1.2 KiB
Diff
From c2fc41990a77923c44a71d616561920ae186db56 Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
Date: Tue, 27 Jan 2015 16:48:53 +0100
|
|
Subject: [PATCH 256/506] linux/hostdisk: Limit strcpy size to buffer size.
|
|
|
|
Found by: Coverity scan.
|
|
---
|
|
grub-core/osdep/linux/hostdisk.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c
|
|
index c96427a..75cb8f5 100644
|
|
--- a/grub-core/osdep/linux/hostdisk.c
|
|
+++ b/grub-core/osdep/linux/hostdisk.c
|
|
@@ -376,7 +376,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f
|
|
|
|
part_start = grub_partition_get_start (disk->partition);
|
|
|
|
- strcpy (dev, grub_util_biosdisk_get_osdev (disk));
|
|
+ strlcpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev));
|
|
if (disk->partition
|
|
&& strncmp (dev, "/dev/", 5) == 0)
|
|
{
|
|
@@ -439,7 +439,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f
|
|
if (*max == 0)
|
|
*max = ~0ULL;
|
|
is_partition = 0;
|
|
- strcpy (dev, grub_util_biosdisk_get_osdev (disk));
|
|
+ strlcpy (dev, grub_util_biosdisk_get_osdev (disk), sizeof (dev));
|
|
goto reopen;
|
|
}
|
|
sector -= part_start;
|
|
--
|
|
2.4.3
|
|
|