From cf8c46cb509ca4704c0e714d28bbed7d0c214c2e Mon Sep 17 00:00:00 2001 From: yvs Date: Fri, 8 May 2026 17:28:05 +0400 Subject: [PATCH] curses: validate packet size input Port the interactive packet-size validation from yvs2014/mtr085. The curses s command now validates the newly entered value before assigning it, matching the command-line packet-size range. Ported-from: yvs2014/mtr085@e100fd72be37f0a98d6893db7e0baa8a5b81b72a Original-author: yvs --- ui/curses.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/curses.c b/ui/curses.c index 5c776e9..aa9a57c 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -217,8 +217,11 @@ int mtr_curses_keyaction( } buf[i] = '\0'; int new_packetsize = atoi(buf); - if (abs(ctl->cpacketsize) >= MINPACKET && abs(ctl->cpacketsize) < MAXPACKET) { + if (abs(new_packetsize) >= MINPACKET + && abs(new_packetsize) <= MAXPACKET) { ctl->cpacketsize = new_packetsize; + } else { + printf("\a"); } return ActionNone; case 'b': -- 2.47.3