From f642db95282d945a0c40a8ff71cecc3ecbfd759a Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 31 Oct 2023 01:08:51 +0000 Subject: [PATCH] Update awk to Oct 30, 2023 version. This is really just a version number bump as we already have the fixes committed. --- usr.bin/awk/FIXES | 9 +++++++++ usr.bin/awk/main.c | 15 +++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES index e3dedacf485..a13ca50ccde 100644 --- a/usr.bin/awk/FIXES +++ b/usr.bin/awk/FIXES @@ -25,6 +25,15 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the second edition of the AWK book was published in September 2023. +Oct 30, 2023: + multiple fixes and a minor code cleanup. + disabled utf-8 for non-multibyte locales, such as C or POSIX. + fixed a bad char * cast that causes incorrect results on big-endian + systems. also fixed an out-of-bounds read for empty CCL. + fixed a buffer overflow in substr with utf-8 strings. + many thanks to Todd C Miller. + + Sep 24, 2023: fnematch and getrune have been overhauled to solve issues around unicode FS and RS. also fixed gsub null match issue with unicode. diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 55794c6ff15..d5acca8368f 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.63 2023/10/06 22:29:24 millert Exp $ */ +/* $OpenBSD: main.c,v 1.64 2023/10/31 01:08:51 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20231001"; +const char *version = "version 20231030"; #define DEBUG #include @@ -35,9 +35,9 @@ const char *version = "version 20231001"; #include #include "awk.h" +extern char *__progname; extern char **environ; extern int nfields; -extern char *__progname; int dbg = 0; Awkfloat srand_seed = 1; @@ -138,8 +138,8 @@ int main(int argc, char *argv[]) setlocale(LC_CTYPE, ""); setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ awk_mb_cur_max = MB_CUR_MAX; - cmdname = __progname; + if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) { fprintf(stderr, "%s: pledge: incorrect arguments\n", cmdname); @@ -149,9 +149,8 @@ int main(int argc, char *argv[]) if (argc == 1) { fprintf(stderr, "usage: %s [-safe] [-V] [-d[n]] " "[-f fs | --csv] [-v var=value]\n" - "\t [prog | -f progfile] file ...\n", - cmdname); - exit(1); + "\t [prog | -f progfile] file ...\n", cmdname); + return 1; } #ifdef SA_SIGINFO { @@ -216,7 +215,7 @@ int main(int argc, char *argv[]) dbg = 1; printf("awk %s\n", version); break; - case 'V': /* added for exptools "standard" */ + case 'V': printf("awk %s\n", version); return 0; default: -- 2.20.1