openbsd-ports/devel/gdb/patches/patch-bfd_peXXigen_c

23 lines
859 B
Plaintext

$OpenBSD: patch-bfd_peXXigen_c,v 1.1 2011/10/28 14:42:43 espie Exp $
Fix out-of-bounds memcpys (FILNMLEN is 18, sizeof x_fname is 14).
--- bfd/peXXigen.c.orig Tue Oct 25 15:31:49 2011
+++ bfd/peXXigen.c Tue Oct 25 15:32:39 2011
@@ -249,7 +249,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:
@@ -323,7 +323,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;