diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2024-08-03 21:12:17 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2024-08-03 21:12:17 +0000 |
commit | 237c0548fd402837033a6828c1e7b68d77ede4ec (patch) | |
tree | c03b804849f4746ece21e733fcb8c6b47cab1573 /usr.bin/awk | |
parent | abf92e24cbe1b61b1dac99a2a04228b07a0d2833 (diff) |
Update awk to the July 28, 2024 version.
* Fixed readcsvrec resize segfault when reading csv records longer than 8k.
* Rewrite if-else chain in quoted as a switch.
Diffstat (limited to 'usr.bin/awk')
-rw-r--r-- | usr.bin/awk/FIXES | 9 | ||||
-rw-r--r-- | usr.bin/awk/b.c | 53 | ||||
-rw-r--r-- | usr.bin/awk/lib.c | 4 | ||||
-rw-r--r-- | usr.bin/awk/main.c | 4 |
4 files changed, 46 insertions, 24 deletions
diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES index 5bfc3cada83..ad8bce2645f 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. +Jul 28, 2024 + Fixed readcsvrec resize segfault when reading csv records longer + than 8k. Thanks to Ozan Yigit. + mktime() added to bsd-features branch. Thanks to Todd Miller. + +Jun 23, 2024 + Fix signal for system-status test. Thanks to Tim van der Molen. + Rewrite if-else chain as switch. Thanks to Andrew Sukach. + May 27, 2024 Spelling fixes and removal of unneeded prototypes and extern. Thanks to Jonathan Gray. diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c index 53a36d27b63..8b5ef83b272 100644 --- a/usr.bin/awk/b.c +++ b/usr.bin/awk/b.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b.c,v 1.53 2024/06/03 00:55:05 millert Exp $ */ +/* $OpenBSD: b.c,v 1.54 2024/08/03 21:12:16 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -372,36 +372,49 @@ int quoted(const uschar **pp) /* pick up next thing after a \\ */ /* BUG: should advance by utf-8 char even if makes no sense */ - if ((c = *p++) == 't') { + switch ((c = *p++)) { + case 't': c = '\t'; - } else if (c == 'n') { + break; + case 'n': c = '\n'; - } else if (c == 'f') { + break; + case 'f': c = '\f'; - } else if (c == 'r') { + break; + case 'r': c = '\r'; - } else if (c == 'b') { + break; + case 'b': c = '\b'; - } else if (c == 'v') { + break; + case 'v': c = '\v'; - } else if (c == 'a') { + break; + case 'a': c = '\a'; - } else if (c == '\\') { + break; + case '\\': c = '\\'; - } else if (c == 'x') { /* 2 hex digits follow */ - c = hexstr(&p, 2); /* this adds a null if number is invalid */ - } else if (c == 'u') { /* unicode char number up to 8 hex digits */ + break; + case 'x': /* 2 hex digits follow */ + c = hexstr(&p, 2); /* this adds a null if number is invalid */ + break; + case 'u': /* unicode char number up to 8 hex digits */ c = hexstr(&p, 8); - } else if (isoctdigit(c)) { /* \d \dd \ddd */ - int n = c - '0'; - if (isoctdigit(*p)) { - n = 8 * n + *p++ - '0'; - if (isoctdigit(*p)) + break; + default: + if (isoctdigit(c)) { /* \d \dd \ddd */ + int n = c - '0'; + if (isoctdigit(*p)) { n = 8 * n + *p++ - '0'; + if (isoctdigit(*p)) + n = 8 * n + *p++ - '0'; + } + c = n; } - c = n; - } /* else */ - /* c = c; */ + } + *pp = p; return c; } diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index ecd33d5edea..edf9c8396e9 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.58 2024/06/03 00:55:05 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.59 2024/08/03 21:12:16 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -228,7 +228,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec char *rs = getsval(rsloc); if (CSV) { - c = readcsvrec(pbuf, pbufsize, inf, newflag); + c = readcsvrec(&buf, &bufsize, inf, newflag); isrec = (c == EOF && rr == buf) ? false : true; } else if (*rs && rs[1]) { bool found; diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 5c4241d5a1b..584ece4d813 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.71 2024/06/03 00:58:04 millert Exp $ */ +/* $OpenBSD: main.c,v 1.72 2024/08/03 21:12:16 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 20240527"; +const char *version = "version 20240728"; #define DEBUG #include <stdio.h> |