aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Konovalov <maxim@FreeBSD.org>2026-09-21 23:32:09 +0000
committerMaxim Konovalov <maxim@FreeBSD.org>2026-09-22 02:36:46 +0000
commit04fcf30961266cd77139b40774cb0d6ef6eb2be5 (patch)
tree8eed102d6300bcec69179faf0c923f8872975c07
parent30c20ca26e105cffc5f37a95964cd9b2cad1b6cd (diff)
dummynet: do not overflow the points[ED_MAX_SAMPLES_NO] array
Otherwise, the following would segfault dnctl pipe 1 config bw 1Mbit/s profile 1025points.txt Found with: Claude Code Sonnet 5 MFC after: 2 weeks
-rw-r--r--sbin/ipfw/dummynet.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c
index a0cefcffd183..3cf9a1854365 100644
--- a/sbin/ipfw/dummynet.c
+++ b/sbin/ipfw/dummynet.c
@@ -959,6 +959,9 @@ load_extra_delays(const char *filename, struct dn_profile *p,
} else if (do_points) {
if (!is_valid_number(name) || !is_valid_number(arg))
errx(ED_EFMT("invalid point found"));
+ if (points_no >= ED_MAX_SAMPLES_NO)
+ errx(ED_EFMT("too many samples, maximum is %d"),
+ ED_MAX_SAMPLES_NO);
if (delay_first) {
points[points_no].delay = atof(name);
points[points_no].prob = atof(arg);