diff options
| author | Florian Westphal <fw@strlen.de> | 2005-06-12 17:21:46 +0000 |
|---|---|---|
| committer | Florian Westphal <fw@strlen.de> | 2005-06-12 17:21:46 +0000 |
| commit | 1cf8ccd8fe1149fae0e24e740683eb024c628c7c (patch) | |
| tree | 92f9dfcdc722edd392be8c8045491e7f25db12da | |
| parent | 74424cb1a557a4eb203296fdc015865f6260958e (diff) | |
| download | ngircd-1cf8ccd8fe1149fae0e24e740683eb024c628c7c.tar.gz ngircd-1cf8ccd8fe1149fae0e24e740683eb024c628c7c.zip | |
Make sure SimpleMessage() sends <= 512 chars
| -rw-r--r-- | src/ngircd/conn.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 3d0bce07..c04327e8 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -16,7 +16,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conn.c,v 1.153 2005/06/12 16:28:55 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.154 2005/06/12 17:21:46 fw Exp $"; #include "imp.h" #include <assert.h> @@ -1650,15 +1650,16 @@ try_resolve: LOCAL void Simple_Message( int Sock, char *Msg ) { + char buf[COMMAND_LEN]; /* Write "simple" message to socket, without using compression * or even the connection write buffers. Used e.g. for error * messages by New_Connection(). */ - assert( Sock > NONE ); assert( Msg != NULL ); - (void)write( Sock, Msg, strlen( Msg ) ); - (void)write( Sock, "\r\n", 2 ); + strlcpy( buf, Msg, sizeof buf - 2); + strlcat( buf, "\r\n", sizeof buf); + (void)write( Sock, buf, strlen( buf ) ); } /* Simple_Error */ |