mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-04 05:53:26 +00:00 
			
		
		
		
	nat: Access data_ptr after we have checked the length
This commit is contained in:
		@@ -1026,15 +1026,15 @@ static struct msgb *rewrite_sms(struct bsc_nat *nat, struct msgb *msg,
 | 
				
			|||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* look into the phone number */
 | 
					 | 
				
			||||||
	if ((data_ptr[0] & 0x01) != 1)
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (data_len < 3) {
 | 
						if (data_len < 3) {
 | 
				
			||||||
		LOGP(DNAT, LOGL_ERROR, "SMS-SUBMIT is too short.\n");
 | 
							LOGP(DNAT, LOGL_ERROR, "SMS-SUBMIT is too short.\n");
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* look into the phone number */
 | 
				
			||||||
 | 
						if ((data_ptr[0] & 0x01) != 1)
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dest_len = data_ptr[2];
 | 
						dest_len = data_ptr[2];
 | 
				
			||||||
	if (data_len < dest_len + 3 || dest_len < 2) {
 | 
						if (data_len < dest_len + 3 || dest_len < 2) {
 | 
				
			||||||
		LOGP(DNAT, LOGL_ERROR, "SMS-SUBMIT can not have TP-DestAddr.\n");
 | 
							LOGP(DNAT, LOGL_ERROR, "SMS-SUBMIT can not have TP-DestAddr.\n");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user