summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpenser Reinhardt <sreinhardt@nagios.com>2014-06-22 16:02:19 -0500
committerJan Wagner <waja@cyconet.org>2014-06-28 18:22:04 +0200
commite7e6edb2f8e43085d02cdda93fe16256ab3a35fe (patch)
treea85f5f4cd6fc14edc7fa368798c47afe26439a0f
parent5866cb0a09876d6b2a84006bda8aa9de7ea467fd (diff)
downloadmonitoring-plugins-e7e6edb.tar.gz
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
-rw-r--r--plugins-root/check_dhcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c
index 1ec5c396..b69a10da 100644
--- a/plugins-root/check_dhcp.c
+++ b/plugins-root/check_dhcp.c
@@ -837,7 +837,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
837 return ERROR; 837 return ERROR;
838 838
839 /* process all DHCP options present in the packet */ 839 /* process all DHCP options present in the packet */
840 for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){ 840 for(x=4;x<MAX_DHCP_OPTIONS_LENGTH-1;){
841 841
842 if((int)offer_packet->options[x]==-1) 842 if((int)offer_packet->options[x]==-1)
843 break; 843 break;