From 68ecccb453d3d954924053741bf224c2a766d0ec Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 11 Feb 2010 13:31:41 +0000 Subject: [PATCH] Ticket #2018: strcpy() is used for overlaping strings. memmove() is used for overlaping strings instead of strcpy(). Signed-off-by: Andrew Borodin --- lib/vfs/mc-vfs/ftpfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vfs/mc-vfs/ftpfs.c b/lib/vfs/mc-vfs/ftpfs.c index fc6f3d5dc..93bfab624 100644 --- a/lib/vfs/mc-vfs/ftpfs.c +++ b/lib/vfs/mc-vfs/ftpfs.c @@ -218,8 +218,9 @@ ftpfs_translate_path (struct vfs_class *me, struct vfs_s_super *super, const cha ret = g_strdup (remote_path); /* replace first occurance of ":/" with ":" */ - if ((p = strchr (ret, ':')) && *(p + 1) == '/') - strcpy (p + 1, p + 2); + p = strchr (ret, ':'); + if ((p != NULL) && (*(p + 1) == '/')) + memmove (p + 1, p + 2, strlen (p + 2) + 1); /* strip trailing "/." */ if ((p = strrchr (ret, '/')) && *(p + 1) == '.' && *(p + 2) == '\0')