freebsd-dev/usr.sbin/ndiscvt
Bill Paul 51d6d0952b Clean up and apply the fix for PR 83477. The calculation for locating
the start of the section headers has to take into account the fact
that the image_nt_header is really variable sized. It happens that
the existing calculation is correct for _most_ production binaries
produced by the Windows DDK, but if we get a binary with oddball
offsets, the PE loader could crash.

Changes from the supplied patch are:

- We don't really need to use the IMAGE_SIZEOF_NT_HEADER() macro when
  computing how much of the header to return to callers of
  pe_get_optional_header(). While it's important to take the variable
  size of the header into account in other calculations, we never
  actually look at anything outside the non-variable portion of the
  header. This saves callers from having to allocate a variable sized
  buffer off the heap (I purposely tried to avoid using malloc()
  in subr_pe.c to make it easier to compile in both the -D_KERNEL and
  !-D_KERNEL case), and since we're copying into a buffer on the
  stack, we always have to copy the same amount of data or else
  we'll trash the stack something fierce.

- We need <stddef.h> to get offsetof() in the !-D_KERNEL case.

- ndiscvt.c needs the IMAGE_FIRST_SECTION() macro too, since it does
  a little bit of section pre-processing.

PR: kern/83477
2005-10-26 18:46:27 +00:00
..
inf-parse.y Clean up ndiscvt a bit (leaving out the -i flag didn't work) and add 2004-01-02 04:31:06 +00:00
inf-token.l - Handle doubled double quotes: 2004-01-11 21:10:35 +00:00
inf.c Update ndiscvt to handle .INF files that specify multiple entries in 2005-05-15 19:46:14 +00:00
inf.h
Makefile Throw the switch on the new driver generation/loading mechanism. From 2005-04-24 20:21:22 +00:00
ndiscvt.8 Fix all the spelling mistakes I could find in the man pages for words 2005-07-31 03:30:48 +00:00
ndiscvt.c Clean up and apply the fix for PR 83477. The calculation for locating 2005-10-26 18:46:27 +00:00
ndisgen.8 (More thoroughly) fix the problem with the EGREP lines that was reported 2005-07-23 18:47:18 +00:00
ndisgen.sh (More thoroughly) fix the problem with the EGREP lines that was reported 2005-07-23 18:47:18 +00:00
windrv_stub.c Fix support for Windows drivers that support both PCI and PCMCIA devices at 2005-05-08 23:07:51 +00:00