Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[slam] Avoid NULL pointer dereference in slam_pull_value()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 21, 2017
1 parent 60561d0 commit 64de7dc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/net/udp/slam.c
Expand Up @@ -400,12 +400,16 @@ static int slam_pull_value ( struct slam_request *slam,
return -EINVAL;
}

/* Read value */
/* Strip value */
iob_pull ( iobuf, len );
*value = ( *data & 0x1f );
while ( --len ) {
*value <<= 8;
*value |= *(++data);

/* Read value, if applicable */
if ( value ) {
*value = ( *data & 0x1f );
while ( --len ) {
*value <<= 8;
*value |= *(++data);
}
}

return 0;
Expand Down

0 comments on commit 64de7dc

Please sign in to comment.