anchao opened a new pull request, #20884:
URL: https://github.com/apache/nuttx/pull/20884

   ## Summary                                                                   
                                                                                
                                               
                                                                                
                                                                                
                                               
   Harden the CDC-MBIM host receive path against malformed NTB input from a 
connected device.                                                               
                                                   
                                                                                
                                                                                
                                               
   The previous parser trusted device-provided NDP offsets, NDP lengths, and 
DPE entries. A malicious device could create an NDP chain that loops forever or 
cause the DPE walk to read past the received NTB. 
                                                                                
                                                                                
                                               
   ## Changes                                                                   
                                                                                
                                               
                                                                                
                                                                                
                                               
   - Validate the NTH header length and NTB block length.                       
                                                                                
                                               
   - Validate the initial NDP offset before dereferencing it.                   
                                                                                
                                               
   - Bound the number of NDPs processed per NTB to prevent cyclic NDP chains.   
                                                                                
                                               
   - Validate each NDP length before walking its DPE entries.                   
                                                                                
                                               
   - Validate `next_ndp_index` before the next iteration.                       
                                                                                
                                               
   - Restrict DPE iteration to the advertised NDP length.                       
                                                                                
                                               
   - Ensure datagram offset/length ranges are contained within the received 
NTB.                                                                            
                                                   
   
   ## Testing
   
   sim/usbdev


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to