From 6ef4752bc90a81600a0a6eb3437c42e02e41b85f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 30 Jul 2018 13:47:01 +0000 Subject: [PATCH] cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0. 2018-07-30 Tom Tromey * cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0. From-SVN: r263069 --- libiberty/ChangeLog | 4 ++++ libiberty/cplus-dem.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index dc5d9971f68..8293fa9ac56 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2018-07-30 Tom Tromey + + * cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0. + 2018-07-26 Martin Liska PR lto/86548 diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 6d58bd899bf..4f29d54d089 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -4471,7 +4471,8 @@ remember_Btype (struct work_stuff *work, const char *start, char *tem; tem = XNEWVEC (char, len + 1); - memcpy (tem, start, len); + if (len > 0) + memcpy (tem, start, len); tem[len] = '\0'; work -> btypevec[index] = tem; } -- 2.30.2