aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
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