commit 62865f7e1910d08ad8d72cb89f830f6d9411ffa2
from: Federico G. Schwindt <fgsch@lodoss.net>
date: Thu Oct 17 21:10:53 2013 UTC

Add support for longer config lines

With the introduction of CipherList we could have longer config lines.
Handle up to 1024 bytes and warn if the line will be truncated.

commit - a7dda1b28c5d425b3fc4e946ff238ca06c9bb64e
commit + 62865f7e1910d08ad8d72cb89f830f6d9411ffa2
blob - b1a371fc4e156e683141ab207607bd458fcfe799
blob + 5f01648c088516a60b2af5fed51c6bc8635be71a
--- src/ngircd/client.c
+++ src/ngircd/client.c
@@ -238,7 +238,7 @@ Client_Destroy( CLIENT *Client, const char *LogMsg, co
 	/* remove a client */
 	
 	CLIENT *last, *c;
-	char msg[LINE_LEN];
+	char msg[COMMAND_LEN];
 	const char *txt;
 
 	assert( Client != NULL );
blob - 372b14c0d05b87a5226c1fb531cada52681fa91d
blob + 16275877a8d9e95f37cbf57ac1b395d55bb86d78
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
@@ -1063,14 +1063,20 @@ static void Read_Config_File(const char *File, FILE *f
 	/* Read configuration file */
 	section[0] = '\0';
 	while (true) {
-		if (!fgets(str, LINE_LEN, fd))
+		if (!fgets(str, sizeof(str), fd))
 			break;
 		ngt_TrimStr(str);
 		line++;
 
 		/* Skip comments and empty lines */
 		if (str[0] == ';' || str[0] == '#' || str[0] == '\0')
+			continue;
+
+		if (strlen(str) >= sizeof(str) - 1) {
+			Config_Error(LOG_WARNING, "%s, line %d too long!",
+				     File, line);
 			continue;
+		}
 
 		/* Is this the beginning of a new section? */
 		if ((str[0] == '[') && (str[strlen(str) - 1] == ']')) {
@@ -1474,7 +1480,7 @@ Handle_GLOBAL(const char *File, int Line, char *Var, c
 		len = strlen(Arg);
 		if (len == 0)
 			return;
-		if (len >= LINE_LEN) {
+		if (len >= 127) {
 			Config_Error_TooLong(File, Line, Var);
 			return;
 		}
blob - efe318625fa5615f0eb4be6be2304275b7a8c072
blob + 361564f00d239b297de3c87ce68e33fb05447ec6
--- src/ngircd/defines.h
+++ src/ngircd/defines.h
@@ -36,7 +36,7 @@
 /* Generic buffer sizes */
 
 /** Max. length of a line in the configuration file. */
-#define LINE_LEN 256
+#define LINE_LEN 1024
 
 /** Max. length of a log message. */
 #define MAX_LOG_MSG_LEN 256
blob - c75b57d596a4d9a4095a89f85153fdaeabb84749
blob + 3c600384b6b2f034a2d3f3455ad07a20e21d639e
--- src/ngircd/hash.c
+++ src/ngircd/hash.c
@@ -37,7 +37,7 @@ static UINT32 jenkins_hash PARAMS((UINT8 *k, UINT32 le
 GLOBAL UINT32
 Hash( const char *String )
 {
-	char buffer[LINE_LEN];
+	char buffer[COMMAND_LEN];
 
 	strlcpy(buffer, String, sizeof(buffer));
 	return jenkins_hash((UINT8 *)ngt_LowerStr(buffer),
blob - d1b4033b3a54d70ef83bab9e729eeafd5123f177
blob + 469527209ac2dfdf423014c26fc3d4b0a116104a
--- src/ngircd/irc-login.c
+++ src/ngircd/irc-login.c
@@ -630,7 +630,7 @@ GLOBAL bool
 IRC_QUIT( CLIENT *Client, REQUEST *Req )
 {
 	CLIENT *target;
-	char quitmsg[LINE_LEN];
+	char quitmsg[COMMAND_LEN];
 
 	assert(Client != NULL);
 	assert(Req != NULL);
blob - 030c3cd1fc043c00f3c99633eb1e33620b2be838
blob + b0abb7cdf2622cac13792c4a2c708baeeaa12e48
--- src/ngircd/irc-server.c
+++ src/ngircd/irc-server.c
@@ -53,7 +53,7 @@
 GLOBAL bool
 IRC_SERVER( CLIENT *Client, REQUEST *Req )
 {
-	char str[LINE_LEN];
+	char str[100];
 	CLIENT *from, *c;
 	int i;
 
blob - a43739f18bf4dec9b44183396526c157d408b84b
blob + ad7e0429acb32aca1da16b80e65d42b5322c1ac6
--- src/ngircd/numeric.c
+++ src/ngircd/numeric.c
@@ -47,7 +47,7 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
 {
 	CL2CHAN *cl2chan;
 	CLIENT *cl;
-	char str[LINE_LEN], *ptr;
+	char str[COMMAND_LEN], *ptr;
 	bool njoin, xop;
 
 	/* Check features of remote server */
@@ -82,7 +82,7 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
 			strlcat(str, Client_ID(cl), sizeof(str));
 
 			/* Send the data if the buffer is "full" */
-			if (strlen(str) > (LINE_LEN - CLIENT_NICK_LEN - 8)) {
+			if (strlen(str) > (sizeof(str) - CLIENT_NICK_LEN - 8)) {
 				if (!IRC_WriteStrClient(Client, "%s", str))
 					return DISCONNECTED;
 				snprintf(str, sizeof(str), "NJOIN %s :",
blob - 5006d2ff2b73e58e521c8cdfc409b1a59c8ec036
blob + 2c7ba94d5a1e793cf37b25d8c25f3e36185c96d4
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
@@ -423,7 +423,7 @@ Handle_Numeric(CLIENT *client, REQUEST *Req)
 		{ 376, IRC_Num_ENDOFMOTD }
 	};
 	int i, num;
-	char str[LINE_LEN];
+	char str[COMMAND_LEN];
 	CLIENT *prefix, *target = NULL;
 
 	/* Determine target */