* grub-core/fs/ext2.c (grub_ext2_read_symlink): Use memcpy rather
strncpy. * grub-core/fs/jfs.c (grub_jfs_lookup_symlink): Likewise. * grub-core/kern/misc.c (grub_strncpy): Move from here ... * include/grub/misc.h (grub_strncpy): ... to here. Make inline. * grub-core/net/net.c (grub_net_addr_to_str): Use COMPILE_TIME_ASSERT + strcpy rather than strncpy.
This commit is contained in:
parent
8fbe5c7df7
commit
eb03ede014
6 changed files with 29 additions and 19 deletions
|
@ -670,10 +670,10 @@ grub_ext2_read_symlink (grub_fshelp_node_t node)
|
|||
/* If the filesize of the symlink is bigger than
|
||||
60 the symlink is stored in a separate block,
|
||||
otherwise it is stored in the inode. */
|
||||
if (grub_le_to_cpu32 (diro->inode.size) <= 60)
|
||||
grub_strncpy (symlink,
|
||||
diro->inode.symlink,
|
||||
grub_le_to_cpu32 (diro->inode.size));
|
||||
if (grub_le_to_cpu32 (diro->inode.size) <= sizeof (diro->inode.symlink))
|
||||
grub_memcpy (symlink,
|
||||
diro->inode.symlink,
|
||||
grub_le_to_cpu32 (diro->inode.size));
|
||||
else
|
||||
{
|
||||
grub_ext2_read_file (diro, 0, 0, 0,
|
||||
|
|
|
@ -723,7 +723,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, grub_uint32_t ino)
|
|||
if (!symlink)
|
||||
return grub_errno;
|
||||
if (size <= sizeof (data->currinode.symlink.path))
|
||||
grub_strncpy (symlink, (char *) (data->currinode.symlink.path), size);
|
||||
grub_memcpy (symlink, (char *) (data->currinode.symlink.path), size);
|
||||
else if (grub_jfs_read_file (data, 0, 0, 0, size, symlink) < 0)
|
||||
{
|
||||
grub_free (symlink);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue