fixed a boundary check bug in qse_dhcp6_find_option()
This commit is contained in:
		| @ -4,7 +4,7 @@ | ||||
| qse_dhcp6_opt_hdr_t* qse_dhcp6_find_option (const qse_dhcp6_pktinf_t* pkt, int code) | ||||
| { | ||||
| 	qse_dhcp6_opt_hdr_t* opt; | ||||
| 	qse_size_t rem; | ||||
| 	qse_size_t rem, opt_len; | ||||
|  | ||||
| 	if (pkt->len < QSE_SIZEOF(qse_dhcp6_pkt_hdr_t)) return QSE_NULL; | ||||
|  | ||||
| @ -29,7 +29,9 @@ qse_dhcp6_opt_hdr_t* qse_dhcp6_find_option (const qse_dhcp6_pktinf_t* pkt, int c | ||||
| 			return opt; | ||||
| 		} | ||||
|  | ||||
| 		rem -= QSE_SIZEOF(qse_dhcp6_opt_hdr_t) + qse_ntoh16(opt->len); | ||||
| 		opt_len = QSE_SIZEOF(qse_dhcp6_opt_hdr_t) + qse_ntoh16(opt->len); | ||||
| 		if (rem < opt_len) break; | ||||
| 		rem -= opt_len; | ||||
| 		opt = (qse_dhcp6_opt_hdr_t*)((qse_uint8_t*)(opt + 1) + qse_ntoh16(opt->len)); | ||||
| 		 | ||||
| 	} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user