From: Michael Brown Date: Tue, 21 Mar 2017 12:57:36 +0000 (+0200) Subject: [slam] Avoid NULL pointer dereference in slam_pull_value() X-Git-Tag: v1.20.1~273 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64de7dc7fd06470424bb4c3ea537f542c46895c4;p=thirdparty%2Fipxe.git [slam] Avoid NULL pointer dereference in slam_pull_value() Signed-off-by: Michael Brown --- diff --git a/src/net/udp/slam.c b/src/net/udp/slam.c index 61dd7d985..c165b4fb9 100644 --- a/src/net/udp/slam.c +++ b/src/net/udp/slam.c @@ -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;