From 0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 20 Dec 2019 12:33:37 +0200 Subject: Sanitization fix from Paul Eggert. --- field.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'field.c') diff --git a/field.c b/field.c index 8c7fe18e..28891c85 100644 --- a/field.c +++ b/field.c @@ -288,7 +288,9 @@ set_record(const char *buf, int cnt, const awk_fieldwidth_info_t *fw) memset(databuf, '\0', databuf_size); } /* copy the data */ - memcpy(databuf, buf, cnt); + if (cnt != 0) { + memcpy(databuf, buf, cnt); + } /* * Add terminating '\0' so that C library routines -- cgit v1.2.3