[geany/geany] 89b7e0: Fix invalid use of strcpy() on overlapping memory

Colomban Wendling git-noreply at xxxxx
Mon Jul 30 22:33:53 UTC 2012


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 30 Jul 2012 22:33:53
Commit:      89b7e089c42f52c50dba70bb508d8803fa830f0a
             https://github.com/geany/geany/commit/89b7e089c42f52c50dba70bb508d8803fa830f0a

Log Message:
-----------
Fix invalid use of strcpy() on overlapping memory

strcpy()'s behavior on overlapping memory is undefined, so replace such
uses with memmove().

Based on CTags r783: https://ctags.svn.sourceforge.net/svnroot/ctags@783


Modified Paths:
--------------
    tagmanager/ctags/ctags.c

Modified: tagmanager/ctags/ctags.c
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -739,13 +739,13 @@ static char* absoluteFilename (const char *file)
 		else if (cp [0] != '/')
 		    cp = slashp;
 #endif
-		strcpy (cp, slashp + 3);
+		memmove (cp, slashp + 3, strlen (slashp + 3) + 1);
 		slashp = cp;
 		continue;
 	    }
 	    else if (slashp [2] == '/'  ||  slashp [2] == '\0')
 	    {
-		strcpy (slashp, slashp + 2);
+		memmove (slashp, slashp + 2, strlen (slashp + 2) + 1);
 		continue;
 	    }
 	}


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list