Browse Source

[slam] Avoid NULL pointer dereference in slam_pull_value()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
64de7dc7fd
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      src/net/udp/slam.c

+ 9
- 5
src/net/udp/slam.c View File

400
 		return -EINVAL;
400
 		return -EINVAL;
401
 	}
401
 	}
402
 
402
 
403
-	/* Read value */
403
+	/* Strip value */
404
 	iob_pull ( iobuf, len );
404
 	iob_pull ( iobuf, len );
405
-	*value = ( *data & 0x1f );
406
-	while ( --len ) {
407
-		*value <<= 8;
408
-		*value |= *(++data);
405
+
406
+	/* Read value, if applicable */
407
+	if ( value ) {
408
+		*value = ( *data & 0x1f );
409
+		while ( --len ) {
410
+			*value <<= 8;
411
+			*value |= *(++data);
412
+		}
409
 	}
413
 	}
410
 
414
 
411
 	return 0;
415
 	return 0;

Loading…
Cancel
Save