Fix wrong strncpy usage if CVSDATE defined

Hello_User() used strncpy with overlapping src/dest.
Use memmove instead.
This commit is contained in:
Florian Westphal 2008-02-05 11:46:55 +00:00
parent 59b19ea6a3
commit 42db159d26
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.54 2007/11/21 12:16:36 alex Exp $"; static char UNUSED id[] = "$Id: irc-login.c,v 1.55 2008/02/05 11:46:55 fw Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -601,8 +601,8 @@ Hello_User( CLIENT *Client )
/* Version and system type */ /* Version and system type */
#ifdef CVSDATE #ifdef CVSDATE
strlcpy( ver, CVSDATE, sizeof( ver )); strlcpy( ver, CVSDATE, sizeof( ver ));
strncpy( ver + 4, ver + 5, 2 ); memmove( ver + 4, ver + 5, 2 );
strncpy( ver + 6, ver + 8, 3 ); memmove( ver + 6, ver + 8, 3 );
snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver ); snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver );
if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return false; if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return false;
#else #else