mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-11-04 07:52:59 +00:00 
			
		
		
		
	Fixed a possible buffer underrun when reading the MOTD file. Thanks to
Florian Westphal, <westphal@foo.fh-furtwangen.de>. [from HEAD].
This commit is contained in:
		@@ -12,6 +12,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ngircd 0.8.x (CVS)
 | 
					ngircd 0.8.x (CVS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - Fixed a possible buffer underrun when reading the MOTD file. Thanks
 | 
				
			||||||
 | 
					    to Florian Westphal, <westphal@foo.fh-furtwangen.de>.
 | 
				
			||||||
  - Fixed detection of IRC lines which are too long to send. Detected by
 | 
					  - Fixed detection of IRC lines which are too long to send. Detected by
 | 
				
			||||||
    Florian Westphal, <westphal@foo.fh-furtwangen.de>.
 | 
					    Florian Westphal, <westphal@foo.fh-furtwangen.de>.
 | 
				
			||||||
  - Fixed return values of our own implementation of strlcpy(). The code has
 | 
					  - Fixed return values of our own implementation of strlcpy(). The code has
 | 
				
			||||||
@@ -549,4 +551,4 @@ ngIRCd 0.0.1, 31.12.2001
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 
 | 
					-- 
 | 
				
			||||||
$Id: ChangeLog,v 1.233.2.13 2005/01/19 23:35:42 alex Exp $
 | 
					$Id: ChangeLog,v 1.233.2.14 2005/01/24 14:22:30 alex Exp $
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "portab.h"
 | 
					#include "portab.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.21.2.1 2004/05/07 11:24:18 alex Exp $";
 | 
					static char UNUSED id[] = "$Id: irc-info.c,v 1.21.2.2 2005/01/24 14:22:30 alex Exp $";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "imp.h"
 | 
					#include "imp.h"
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
@@ -770,6 +770,7 @@ IRC_Show_MOTD( CLIENT *Client )
 | 
				
			|||||||
	BOOLEAN ok;
 | 
						BOOLEAN ok;
 | 
				
			||||||
	CHAR line[127];
 | 
						CHAR line[127];
 | 
				
			||||||
	FILE *fd;
 | 
						FILE *fd;
 | 
				
			||||||
 | 
						UINT line_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert( Client != NULL );
 | 
						assert( Client != NULL );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -790,8 +791,12 @@ IRC_Show_MOTD( CLIENT *Client )
 | 
				
			|||||||
	if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
 | 
						if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
 | 
				
			||||||
	while( TRUE )
 | 
						while( TRUE )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( ! fgets( line, 126, fd )) break;
 | 
							if( ! fgets( line, sizeof( line ), fd )) break;
 | 
				
			||||||
		if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
 | 
					
 | 
				
			||||||
 | 
							line_len = strlen( line );
 | 
				
			||||||
 | 
							if( line_len > 0 ) line_len--;
 | 
				
			||||||
 | 
							if( line[line_len] == '\n' ) line[line_len] = '\0';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
 | 
							if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			fclose( fd );
 | 
								fclose( fd );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user