ref: 522a15d47ee76cab96415c8970b8dd2ae6b62d4b
parent: b404b49c19a0c7923c32b120da99d6fa846010fe
parent: 5e49ea4d1f71d9134734011f2151cae4dbec5e5f
author: Arnold D. Robbins <arnold@skeeve.com>
date: Thu Dec 15 15:37:02 EST 2022
Merge branch 'master' into unicode-support
--- a/FIXES
+++ b/FIXES
@@ -25,6 +25,12 @@
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August 1987.
+Dec 15, 2022:
+ Force hex escapes in strings to be no more than two characters,
+ as they already are in regular expressions. This brings internal
+ consistency, as well as consistency with gawk. Thanks to
+ Arnold Robbins.
+
Sep 12, 2022:
adjbuf minlen error (cannot be 0) in cat, resulting in NULL pbuf.
discovered by todd miller. also use-after-free issue with
--- a/lex.c
+++ b/lex.c
@@ -416,19 +416,28 @@
break;
case 'x': /* hex \x0-9a-fA-F + */
- { char xbuf[100], *px;- for (px = xbuf; (c = input()) != 0 && px-xbuf < 100-2; ) {- if (isdigit(c)
- || (c >= 'a' && c <= 'f')
- || (c >= 'A' && c <= 'F'))
- *px++ = c;
- else
+ {+ int i;
+
+ n = 0;
+ for (i = 1; i <= 2; i++) {+ c = input();
+ if (c == 0)
break;
+ if (isxdigit(c)) {+ c = tolower(c);
+ n *= 16;
+ if (isdigit(c))
+ n += (c - '0');
+ else
+ n += 10 + (c - 'a');
+ } else
+ break;
}
- *px = 0;
- unput(c);
- sscanf(xbuf, "%x", (unsigned int *) &n);
- *bp++ = n;
+ if (n)
+ *bp++ = n;
+ else
+ unput(c);
break;
}
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
THIS SOFTWARE.
****************************************************************/
-const char *version = "One True Awk 20221014";
+const char *version = "version 20221215";
#define DEBUG
#include <stdio.h>
--
⑨