[IPV4]: ipconfig should use memmove() instead of strcpy()

Linux Kernel Mailing List <[email protected]>
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1539.1.8, 2005/02/06 22:21:22-08:00, [email protected]

	[IPV4]: ipconfig should use memmove() instead of strcpy()
	
	strcpy is undefined if src and dest overlap.  That's clearly possible
	here with a sufficiently deep path on the server.  Use memmove instead.
	
	Signed-off-by: Matthew Wilcox <[email protected]>



 ipconfig.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
--- a/net/ipv4/ipconfig.c	2005-02-09 09:08:11 -08:00
+++ b/net/ipv4/ipconfig.c	2005-02-09 09:08:11 -08:00
@@ -1162,7 +1162,7 @@
 		if (*cp == ':')
 			*cp++ = '\0';
 		addr = in_aton(name);
-		strcpy(name, cp);
+		memmove(name, cp, strlen(cp) + 1);
 	} else
 		addr = INADDR_NONE;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.