Skip to content

Commit

Permalink
linux/hostdisk: Limit strcpy size to buffer size.
Browse files Browse the repository at this point in the history
Found by: Coverity scan.
  • Loading branch information
phcoder committed Jan 27, 2015
1 parent 916733e commit c2fc419
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grub-core/osdep/linux/hostdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c2fc419

Please sign in to comment.