mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	Applied Francois Dupoux's extra checks for weird packet or padding length in
incoming packets. We really need to bail out this way on weird input. bug report #2814613
This commit is contained in:
		@@ -431,7 +431,12 @@ _libssh2_transport_read(LIBSSH2_SESSION * session)
 | 
				
			|||||||
             * and we can extract packet and padding length from it
 | 
					             * and we can extract packet and padding length from it
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
            p->packet_length = _libssh2_ntohu32(block);
 | 
					            p->packet_length = _libssh2_ntohu32(block);
 | 
				
			||||||
 | 
					            if ((p->packet_length < 1) || (p->packet_length > PACKETBUFSIZE))
 | 
				
			||||||
 | 
					                return PACKET_FAIL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            p->padding_length = block[4];
 | 
					            p->padding_length = block[4];
 | 
				
			||||||
 | 
					            if (p->padding_length < 0)
 | 
				
			||||||
 | 
					                return PACKET_FAIL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* total_num is the number of bytes following the initial
 | 
					            /* total_num is the number of bytes following the initial
 | 
				
			||||||
               (5 bytes) packet length and padding length fields */
 | 
					               (5 bytes) packet length and padding length fields */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user