wl pushed a commit to branch master in repository groff. commit dd9d0787a367404fa2a69234a98e7980236b60f4 Author: Bálint Réczey <bal...@balintreczey.hu> Date: Mon Feb 15 23:55:37 2016 +0100
Don't use `memcpy' with NULL input or output argument (#47160). * src/libs/libgroff/string.cpp (string::string, string::operator=): Implement it. * src/roff/troff/input.cpp (temp_iterator::temp_iterator): Implement it. --- ChangeLog | 10 ++++++++++ src/libs/libgroff/string.cpp | 6 ++++-- src/roff/troff/input.cpp | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 700561a..b3cdf1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2016-02-15 Bálint Réczey <bal...@balintreczey.hu> + + Don't use `memcpy' with NULL input or output argument (#47160). + + * src/libs/libgroff/string.cpp (string::string, string::operator=): + Implement it. + + * src/roff/troff/input.cpp (temp_iterator::temp_iterator): Implement + it. + 2016-02-04 Carsten Kunze <carsten.ku...@arcor.de> * tmac/s.tmac: Bugfix of previous commit simplified (and diff --git a/src/libs/libgroff/string.cpp b/src/libs/libgroff/string.cpp index da3b2dc..5614c04 100644 --- a/src/libs/libgroff/string.cpp +++ b/src/libs/libgroff/string.cpp @@ -98,7 +98,8 @@ string::string(const char *p) else { len = strlen(p); ptr = salloc(len, &sz); - memcpy(ptr, p, len); + if (len != 0) + memcpy(ptr, p, len); } } @@ -141,7 +142,8 @@ string &string::operator=(const char *p) int slen = strlen(p); ptr = sfree_alloc(ptr, sz, slen, &sz); len = slen; - memcpy(ptr, p, len); + if (len != 0) + memcpy(ptr, p, len); } return *this; } diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 9594f07..163cffa 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -3596,7 +3596,8 @@ inline temp_iterator::temp_iterator(const char *s, int len) { base = new unsigned char[len]; - memcpy(base, s, len); + if (len > 0) + memcpy(base, s, len); ptr = base; eptr = base + len; } _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit