ota: Merge 20240728 (bsd-feature) from ota 3319c34a8713
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.
This commit is contained in:
@@ -25,6 +25,11 @@ THIS SOFTWARE.
|
|||||||
This file lists all bug fixes, changes, etc., made since the
|
This file lists all bug fixes, changes, etc., made since the
|
||||||
second edition of the AWK book was published in September 2023.
|
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
|
Jun 23, 2024
|
||||||
Fix signal for system-status test. Thanks to Tim van der Molen.
|
Fix signal for system-status test. Thanks to Tim van der Molen.
|
||||||
Rewrite if-else chain as switch. Thanks to Andrew Sukach.
|
Rewrite if-else chain as switch. Thanks to Andrew Sukach.
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ extern Cell *symtabloc; /* SYMTAB */
|
|||||||
#define FRSHIFT 20
|
#define FRSHIFT 20
|
||||||
#define FSYSTIME 21
|
#define FSYSTIME 21
|
||||||
#define FSTRFTIME 22
|
#define FSTRFTIME 22
|
||||||
|
#define FMKTIME 23
|
||||||
|
|
||||||
/* Node: parse tree is made of nodes, with Cell's at bottom */
|
/* Node: parse tree is made of nodes, with Cell's at bottom */
|
||||||
|
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ static void resize_gototab(fa *f, int state)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
overflo(__func__);
|
overflo(__func__);
|
||||||
|
|
||||||
// need to initialized the new memory to zero
|
// need to initialize the new memory to zero
|
||||||
size_t orig_size = f->gototab[state].allocated; // 2nd half of new mem is this size
|
size_t orig_size = f->gototab[state].allocated; // 2nd half of new mem is this size
|
||||||
memset(p + orig_size, 0, orig_size * sizeof(gtte)); // clean it out
|
memset(p + orig_size, 0, orig_size * sizeof(gtte)); // clean it out
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ const Keyword keywords[] = { /* keep sorted: binary searched */
|
|||||||
{ "log", FLOG, BLTIN },
|
{ "log", FLOG, BLTIN },
|
||||||
{ "lshift", FLSHIFT, BLTIN },
|
{ "lshift", FLSHIFT, BLTIN },
|
||||||
{ "match", MATCHFCN, MATCHFCN },
|
{ "match", MATCHFCN, MATCHFCN },
|
||||||
|
{ "mktime", FMKTIME, BLTIN },
|
||||||
{ "next", NEXT, NEXT },
|
{ "next", NEXT, NEXT },
|
||||||
{ "nextfile", NEXTFILE, NEXTFILE },
|
{ "nextfile", NEXTFILE, NEXTFILE },
|
||||||
{ "or", FFOR, BLTIN },
|
{ "or", FFOR, BLTIN },
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec
|
|||||||
char *rs = getsval(rsloc);
|
char *rs = getsval(rsloc);
|
||||||
|
|
||||||
if (CSV) {
|
if (CSV) {
|
||||||
c = readcsvrec(pbuf, pbufsize, inf, newflag);
|
c = readcsvrec(&buf, &bufsize, inf, newflag);
|
||||||
isrec = (c == EOF && rr == buf) ? false : true;
|
isrec = (c == EOF && rr == buf) ? false : true;
|
||||||
} else if (*rs && rs[1]) {
|
} else if (*rs && rs[1]) {
|
||||||
bool found;
|
bool found;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
const char *version = "version 20240623";
|
const char *version = "version 20240728";
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -2069,7 +2069,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
time_t tv;
|
time_t tv;
|
||||||
struct tm *tm;
|
struct tm *tm, tmbuf;
|
||||||
int estatus = 0;
|
int estatus = 0;
|
||||||
|
|
||||||
t = ptoi(a[0]);
|
t = ptoi(a[0]);
|
||||||
@@ -2223,6 +2223,26 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis
|
|||||||
else
|
else
|
||||||
u = fflush(fp);
|
u = fflush(fp);
|
||||||
break;
|
break;
|
||||||
|
case FMKTIME:
|
||||||
|
memset(&tmbuf, 0, sizeof(tmbuf));
|
||||||
|
tm = &tmbuf;
|
||||||
|
t = sscanf(getsval(x), "%d %d %d %d %d %d %d",
|
||||||
|
&tm->tm_year, &tm->tm_mon, &tm->tm_mday, &tm->tm_hour,
|
||||||
|
&tm->tm_min, &tm->tm_sec, &tm->tm_isdst);
|
||||||
|
switch (t) {
|
||||||
|
case 6:
|
||||||
|
tm->tm_isdst = -1; /* let mktime figure it out */
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
case 7:
|
||||||
|
tm->tm_year -= 1900;
|
||||||
|
tm->tm_mon--;
|
||||||
|
u = mktime(tm);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
u = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case FSYSTIME:
|
case FSYSTIME:
|
||||||
u = time((time_t *) 0);
|
u = time((time_t *) 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user