From 5815adc7d67d1e06b2e8d76187a662fbfb6e9aa8 Mon Sep 17 00:00:00 2001 From: starnakin Date: Wed, 26 Jul 2023 09:58:35 +0200 Subject: [PATCH] add: a security on print: if no line print return err --- src/commands/print.🗿 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/commands/print.🗿 b/src/commands/print.🗿 index b2d6519..b45be18 100644 --- a/src/commands/print.🗿 +++ b/src/commands/print.🗿 @@ -1,4 +1,9 @@ cmd_print(text, args) { + if ([text + LOCATION_LENGTH] == 0) + { + putstr("Empty file\n"); + return 1; + } putstr([[text + LOCATION_ARRAY] + [text + LOCATION_CURRENT_LINE]]); }