From: Ken Raeburn Date: Sat, 14 Oct 2006 01:00:40 +0000 (+0000) Subject: Don't strncpy a string to itself X-Git-Tag: krb5-1.6-alpha1~61 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=39534c75341d68f8f571d3045cbadd37669317d1;p=krb5.git Don't strncpy a string to itself git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18701 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c index 6ef4e886e..93ace9088 100644 --- a/src/appl/gssftp/ftp/ftp.c +++ b/src/appl/gssftp/ftp/ftp.c @@ -1684,7 +1684,8 @@ void pswitch(int flag) ip->connect = connected; connected = op->connect; if (hostname) { - (void) strncpy(ip->name, hostname, sizeof(ip->name) - 1); + if (ip->name != hostname) + (void) strncpy(ip->name, hostname, sizeof(ip->name) - 1); ip->name[strlen(ip->name)] = '\0'; } else ip->name[0] = 0;