From dc7af7d5fe1c55b97bbbef65ea10160ea0b718a4 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 9 Aug 2007 20:07:59 +0000 Subject: Don't use strncpy for moving a chunk of memory to another that is overlapping. This was found by running Asterisk under valgrind. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78829 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_minivm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/app_minivm.c') diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 14729c8d1..a868bac83 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -2275,11 +2275,11 @@ static char *message_template_parse_emailbody(const char *configuration) int len = strlen("\n"); switch (tmpwrite[1]) { case 'n': - strncpy(tmpwrite+len, tmpwrite+2, strlen(tmpwrite+2)+1); + memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1); strncpy(tmpwrite, "\n", len); break; case 't': - strncpy(tmpwrite+len, tmpwrite+2, strlen(tmpwrite+2)+1); + memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1); strncpy(tmpwrite, "\t", len); break; default: -- cgit v1.2.3