Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[pxe] Check for a valid PXE network device when applicable
Very nasty things can happen if a NULL network device is used.  Check
that pxe_netdev is non-NULL at the applicable entry points, so that
this type of problem gets reported to the caller rather than being
allowed to crash the system.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Dec 8, 2011
1 parent 29651e0 commit faf50e8
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/arch/i386/interface/pxe/pxe_preboot.c
Expand Up @@ -155,6 +155,14 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
get_cached_info->Buffer.segment,
get_cached_info->Buffer.offset, get_cached_info->BufferSize );

/* Sanity check */
if ( ! pxe_netdev ) {
DBGC ( &pxe_netdev, "PXENV_GET_CACHED_INFO called with no "
"network device\n" );
get_cached_info->Status = PXENV_STATUS_UNDI_INVALID_STATE;
return PXENV_EXIT_FAILURE;
}

/* Sanity check */
idx = ( get_cached_info->PacketType - 1 );
if ( idx >= NUM_CACHED_INFOS ) {
Expand Down

0 comments on commit faf50e8

Please sign in to comment.