With the introduction of CipherList we could have longer config lines.
Handle up to 1024 bytes and warn if the line will be truncated.
/* remove a client */
CLIENT *last, *c;
- char msg[LINE_LEN];
+ char msg[COMMAND_LEN];
const char *txt;
assert( Client != NULL );
/* 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++;
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] == ']')) {
strlcpy(section, str, sizeof(section));
len = strlen(Arg);
if (len == 0)
return;
- if (len >= LINE_LEN) {
+ if (len >= 127) {
Config_Error_TooLong(File, Line, Var);
return;
}
/* 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
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),
IRC_QUIT( CLIENT *Client, REQUEST *Req )
{
CLIENT *target;
- char quitmsg[LINE_LEN];
+ char quitmsg[COMMAND_LEN];
assert(Client != NULL);
assert(Req != NULL);
GLOBAL bool
IRC_SERVER( CLIENT *Client, REQUEST *Req )
{
- char str[LINE_LEN];
+ char str[100];
CLIENT *from, *c;
int i;
{
CL2CHAN *cl2chan;
CLIENT *cl;
- char str[LINE_LEN], *ptr;
+ char str[COMMAND_LEN], *ptr;
bool njoin, xop;
/* Check features of remote server */
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 :",
{ 376, IRC_Num_ENDOFMOTD }
};
int i, num;
- char str[LINE_LEN];
+ char str[COMMAND_LEN];
CLIENT *prefix, *target = NULL;
/* Determine target */