Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-06-07 11:54:34 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-06-07 11:54:34 +0300
commit113685fbcd4c3432ec9b640583d50ba8da2102e8 (patch)
treebdfe394520f5c6ab19e31c8bde274e737815f81a /editors
parentf4789164e0716a8b1f98cf4149a3eb2dad485b8b (diff)
awk: fix SEGV on read error in -f PROGFILE
function old new delta awk_main 829 843 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editors/awk.c b/editors/awk.c
index b3871ffc5..df9b7fdc9 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -3609,8 +3609,6 @@ static var *evaluate(node *op, var *res)
#undef sreg
}
-/* -------- main & co. -------- */
-
static int awk_exit(void)
{
unsigned i;
@@ -3717,6 +3715,8 @@ int awk_main(int argc UNUSED_PARAM, char **argv)
g_progname = llist_pop(&list_f);
fd = xopen_stdin(g_progname);
s = xmalloc_read(fd, NULL); /* it's NUL-terminated */
+ if (!s)
+ bb_perror_msg_and_die("read error from '%s'", g_progname);
close(fd);
parse_program(s);
free(s);