diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2019-12-20 12:33:37 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2019-12-20 12:33:37 +0200 |
commit | 0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a (patch) | |
tree | 7cd4b20cb1ab73ada18ae6579aef7ee9c43c50f8 | |
parent | ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0 (diff) | |
download | egawk-0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a.tar.gz egawk-0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a.tar.bz2 egawk-0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a.zip |
Sanitization fix from Paul Eggert.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | field.c | 4 |
2 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2019-12-18 Paul Eggert <eggert@Penguin.CS.UCLA.EDU> + + Fix memcpy issue found by -fsanitize=undefined + * field.c (set_record): Don't memcpy (databuf, NULL, 0), + as the C standard says the resulting behavior is undefined. + 2019-12-16 Arnold D. Robbins <arnold@skeeve.com> * awkgram.y, command.y: Upgrade to Bison 3.5. @@ -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 |