diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-07 10:54:34 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-07 10:54:34 +0200 |
commit | 113685fbcd4c3432ec9b640583d50ba8da2102e8 (patch) | |
tree | bdfe394520f5c6ab19e31c8bde274e737815f81a | |
parent | f4789164e0716a8b1f98cf4149a3eb2dad485b8b (diff) | |
download | busybox-w32-113685fbcd4c3432ec9b640583d50ba8da2102e8.tar.gz busybox-w32-113685fbcd4c3432ec9b640583d50ba8da2102e8.tar.bz2 busybox-w32-113685fbcd4c3432ec9b640583d50ba8da2102e8.zip |
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>
-rw-r--r-- | editors/awk.c | 4 |
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) | |||
3609 | #undef sreg | 3609 | #undef sreg |
3610 | } | 3610 | } |
3611 | 3611 | ||
3612 | /* -------- main & co. -------- */ | ||
3613 | |||
3614 | static int awk_exit(void) | 3612 | static int awk_exit(void) |
3615 | { | 3613 | { |
3616 | unsigned i; | 3614 | unsigned i; |
@@ -3717,6 +3715,8 @@ int awk_main(int argc UNUSED_PARAM, char **argv) | |||
3717 | g_progname = llist_pop(&list_f); | 3715 | g_progname = llist_pop(&list_f); |
3718 | fd = xopen_stdin(g_progname); | 3716 | fd = xopen_stdin(g_progname); |
3719 | s = xmalloc_read(fd, NULL); /* it's NUL-terminated */ | 3717 | s = xmalloc_read(fd, NULL); /* it's NUL-terminated */ |
3718 | if (!s) | ||
3719 | bb_perror_msg_and_die("read error from '%s'", g_progname); | ||
3720 | close(fd); | 3720 | close(fd); |
3721 | parse_program(s); | 3721 | parse_program(s); |
3722 | free(s); | 3722 | free(s); |