[ntp:bk-ntp-stable-send] BitKeeper diffs

Harlan Stenn stenn at deacon.udel.edu
Sat Oct 16 04:08:28 UTC 2010


#### ChangeSet ####
2010-10-16 04:02:17+00:00, davehart at shiny.ad.hartbrothers.com 
  min/max confusion in ntpsnmpd change

==== ntpsnmpd/ntpSnmpSubagentObject.c ====
2010-10-16 04:02:17+00:00, davehart at shiny.ad.hartbrothers.com +4 -1
  min/max confusion

--- 1.5/ntpsnmpd/ntpSnmpSubagentObject.c	2010-10-15 20:40:12 -04:00
+++ 1.6/ntpsnmpd/ntpSnmpSubagentObject.c	2010-10-16 00:02:17 -04:00
@@ -171,6 +171,9 @@ ntpsnmpd_cut_string(
 	int l;
 	size_t str_cnt;
 
+	if (maxsize < 1)
+		return 0;
+
 	str_cnt = strlen(string);
 	j = 0;
 	memset(dest, 0, maxsize);
@@ -182,7 +185,7 @@ ntpsnmpd_cut_string(
 		else if (l == fieldnumber && j < maxsize)
 			dest[j++] = string[i]; 
 	}
-	j = max(j, maxsize - 1);
+	j = min(j, maxsize - 1);
 	dest[j] = '\0';
 
 	return j;


More information about the bk-ntp-stable-send mailing list