]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Fix wrong strncpy usage if CVSDATE defined
authorFlorian Westphal <fw@strlen.de>
Tue, 5 Feb 2008 11:46:55 +0000 (11:46 +0000)
committerFlorian Westphal <fw@strlen.de>
Tue, 26 Feb 2008 22:49:33 +0000 (23:49 +0100)
Hello_User() used strncpy with overlapping src/dest.
Use memmove instead.

src/ngircd/irc-login.c

index a095ddc00bbf45ca73b6ac553fbaff73e806756c..1f7038ee8761853c1db69c11427cae7782a22e58 100644 (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 <assert.h>
 
 #include "imp.h"
 #include <assert.h>
@@ -601,8 +601,8 @@ Hello_User( CLIENT *Client )
        /* Version and system type */
 #ifdef CVSDATE
        strlcpy( ver, CVSDATE, sizeof( ver ));
        /* Version and system type */
 #ifdef CVSDATE
        strlcpy( ver, CVSDATE, sizeof( ver ));
-       strncpy( ver + 4, ver + 5, 2 );
-       strncpy( ver + 6, ver + 8, 3 );
+       memmove( ver + 4, ver + 5, 2 );
+       memmove( ver + 6, ver + 8, 3 );
        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;
 #else
        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;
 #else