Re: [PATCH] Handle long lines properly

From: Krzysztof Oledzki <ole#ans.pl>
Date: Mon, 29 Oct 2007 00:17:30 +0100 (CET)

On Mon, 29 Oct 2007, Willy Tarreau wrote: <CUT>
> Could you please move this just above MAX_LINE_ARGS, a few lines
> below,

Of course.

> and maybe at the same time increase MAX_LINE_ARGS ?

64? 128?

>> @@ -2323,6 +2323,15 @@ int readcfgfile(const char *file)
>>
>>  		end = line + strlen(line);
>>
>> +		if (*(end-1) != '\n' && strlen(line) + 1 == sizeof(thisline)) {
>> +			/* Check if the last char is not \n and we reached the limit. Watch out
>> +			 * for the last line without the terminating '\n'!
>> +			 */
>

> I think that the second part of the check is needed, as it seems to
> me that the only case where we can encounter something other than
> '\n' in *(end-1) is precisely when the line has been truncated.

Some editors (like mcedit for example) are able to create a file without a terminating '\n' on the last line. I know that it is wrong but... So, I would like to distinguish such situation from a truncated line as the application should not reject such files, especially with a misleading error message.

Best regards,

                                 Krzysztof Olędzki Received on 2007/10/29 00:17

This archive was generated by hypermail 2.2.0 : 2007/11/04 19:21 CET