On Sun, May 05, 2024 at 12:30:00PM +1000, Jonathan Gray wrote:
> On Sat, May 04, 2024 at 04:59:21PM -0600, Todd C. Miller wrote:
> > CVSROOT: /cvs
> > Module name: src
> > Changes by: [email protected] 2024/05/04 16:59:21
> >
> > Modified files:
> > usr.bin/awk : FIXES b.c lib.c main.c run.c tran.c
> >
> > Log message:
> > Update awk to the May 4, 2024 version.
> > Fixes a use-after-free bug with ARGV for "delete ARGV".
>
> ld: error: undefined symbol: ARGVtab
>
> misses part of your upstream commit
> https://github.com/onetrueawk/awk/commit/d11b2d1a36e92518cea81c717169e2c97e8450d9
ok tb
>
> Index: lib.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/awk/lib.c,v
> diff -u -p -r1.56 lib.c
> --- lib.c 4 May 2024 22:59:21 -0000 1.56
> +++ lib.c 5 May 2024 02:24:14 -0000
> @@ -332,14 +332,16 @@ int readcsvrec(char **pbuf, int *pbufsiz
>
> char *getargv(int n) /* get ARGV[n] */
> {
> + Array *ap;
> Cell *x;
> char *s, temp[50];
> - extern Array *ARGVtab;
> + extern Cell *ARGVcell;
>
> + ap = (Array *)ARGVcell->sval;
> snprintf(temp, sizeof(temp), "%d", n);
> - if (lookup(temp, ARGVtab) == NULL)
> + if (lookup(temp, ap) == NULL)
> return NULL;
> - x = setsymtab(temp, "", 0.0, STR, ARGVtab);
> + x = setsymtab(temp, "", 0.0, STR, ap);
> s = getsval(x);
> DPRINTF("getargv(%d) returns |%s|\n", n, s);
> return s;
>