aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-12-20 12:33:37 +0200
committerArnold D. Robbins <arnold@skeeve.com>2019-12-20 12:33:37 +0200
commit0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a (patch)
tree7cd4b20cb1ab73ada18ae6579aef7ee9c43c50f8 /field.c
parentef3481f8b2564bbe9c3c43cbced3e8edc9608fb0 (diff)
downloadegawk-0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a.tar.gz
egawk-0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a.tar.bz2
egawk-0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a.zip
Sanitization fix from Paul Eggert.
Diffstat (limited to 'field.c')
-rw-r--r--field.c4
1 files changed, 3 insertions, 1 deletions
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