Hello,

could somebody, please, ACK or NAK attached patch.

Thanks,
Z.

--
Zdenek Styblik
email: zdenek.styb...@gmail.com
jabber: zdenek.styb...@gmail.com
@@ -447,7 +459,7 @@
 		     uint8_t chan, uint8_t * ival)
 {
 	struct lan_param *lp;
-	uint8_t interval;
+	uint8_t interval = 0;
 	int rc = 0;
 
 	lp = get_lan_param(intf, chan, IPMI_LANP_GRAT_ARP);
@@ -457,7 +469,11 @@
 		return -1;
 
 	if (ival != 0) {
-		interval = ((uint8_t)atoi((const char *)ival) * 2) - 1;
+		if ( ((*ival * 2) + 1) > UINT8_MAX) {
+			lprintf(LOG_ERR, "ARP interval is out of range: %d", (int)*ival);
+			return (-1);
+		}
+		interval = (*ival * 2) - 1;
 		rc = set_lan_param(intf, chan, IPMI_LANP_GRAT_ARP, &interval, 1);
 	} else {
 		interval = lp->data[0];
@@ -1419,7 +1496,21 @@
 			return 0;
 		}
 		else if (strncmp(argv[2], "interval", 8) == 0) {
-			rc = lan_set_arp_interval(intf, chan, (uint8_t *)argv[3]);
+			uint8_t interval = 0;
+			if (!argv[3]) {
+				lprintf(LOG_ERR, "ARP interval not specified.");
+				lprintf(LOG_NOTICE, "lan set <channel> arp interval <seconds>");
+				return (-1);
+			}
+			if (str2uchar(argv[3], &interval) != 0) {
+				lprintf(LOG_ERR, "Invalid ARP interval: %s", argv[3]);
+				return (-1);
+			}
+			if ( ((interval * 2) + 1) > UINT8_MAX) {
+				lprintf(LOG_ERR, "ARP interval is out of range: %d", (int)interval);
+				return (-1);
+			}
+			rc = lan_set_arp_interval(intf, chan, &interval);
 		}
 		else if (strncmp(argv[2], "generate", 8) == 0) {
 			if (argc < 4) {
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to