[hackers] [sbase] ed: Validate better range for k and z || Roberto E. Vargas Caballero
commit 0ae546333bdbf9f489f8a9508711bf5081bff1cc
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
AuthorDate: Mon Nov 3 13:06:56 2025 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Mon Nov 3 13:06:56 2025 +0100
ed: Validate better range for k and z
The k and z commands require 1 and only one address
so checking for != 1 catches the unsual case when
nlines == 0, that only can happen when we are editing
an empty file.
diff --git a/ed.c b/ed.c
index 2a1c827..6aa5d81 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -1383,7 +1383,7 @@ repeat:
join();
break;
case 'z':
- if (nlines > 1)
+ if (nlines != 1)
goto bad_address;
if (isdigit(back(input())))
num = getnum();
_AT_@ -1393,7 +1393,7 @@ repeat:
scroll(num);
break;
case 'k':
- if (nlines > 1)
+ if (nlines != 1)
goto bad_address;
if (!islower(c = input()))
error("invalid mark character");
Received on Mon Nov 03 2025 - 13:08:35 CET
This archive was generated by hypermail 2.3.0
: Mon Nov 03 2025 - 13:12:41 CET