瀏覽代碼

plugins-root/check_dhcp.c - array out of bounds

Coverity 66488 - offer_packet->options has a max size of 312. It was being used in a loop verifying less than 311, but increasing by 2 per loop, causing a possible array index out of bounds. Changed to checking less than max length - 1. - SR
Spenser Reinhardt 11 年之前
父節點
當前提交
845eff261a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      plugins-root/check_dhcp.c

+ 1 - 1
plugins-root/check_dhcp.c

@@ -837,7 +837,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
 		return ERROR;
 
 	/* process all DHCP options present in the packet */
-	for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){
+	for(x=4;x<MAX_DHCP_OPTIONS_LENGTH-1;){
 
 		if((int)offer_packet->options[x]==-1)
 			break;