openbsd-ports/devel/gdb/patches/patch-bfd_peXXigen_c
2016-10-09 11:39:20 +00:00

23 lines
860 B
Plaintext

$OpenBSD: patch-bfd_peXXigen_c,v 1.6 2016/10/09 11:39:20 pascal Exp $
Fix out-of-bounds memcpys (FILNMLEN is 18, sizeof x_fname is 14).
--- bfd/peXXigen.c.orig Fri Oct 7 19:09:21 2016
+++ bfd/peXXigen.c Fri Oct 7 20:53:14 2016
@@ -311,7 +311,7 @@ _bfd_XXi_swap_aux_in (bfd * abfd,
in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
}
else
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, sizeof in->x_file.x_fname);
return;
case C_STAT:
@@ -385,7 +385,7 @@ _bfd_XXi_swap_aux_out (bfd * abfd,
H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
}
else
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+ memcpy (ext->x_file.x_fname, in->x_file.x_fname, sizeof ext->x_file.x_fname);
return AUXESZ;