[Pkg-clamav-devel] Bug#819061: Bug#819061: clamsmtp/proxsmtp does not handle lines with leading dots correctly

Christoph Pleger Christoph at plmail.de
Mon Feb 19 08:52:44 UTC 2018


Hello,

> But since you asked so nicely I did look into it and found that your 
> patch does
> not apply to clamsmtp.

I attached a version of the patch that applies to clamsmtp. It also 
includes minor other code changes, but that should not change 
functionality.

> Also you made some changes that don't really seem to be related to the
> problem at hand, or why did you do for instance this:
> 
>> -    while((rc = getline(&line, &line_len, file)) != -1)
>> +    while(line = (fgets(buf + 1, buf_len - 1, file)))
> 
> I may be missing something obvious here, though, but I haven't looked
> into clamsmtp's source code much.

getline reads whole lines, that is till '\n' or EOF appears, and 
reallocates the buffer if it was not large enough, so that maybe the 
buffer has a new address after a call of getline. But my method of 
prepending a dot relies on buf and line to share the same memory region, 
with just buf starting one byte earlier. Therefore I switched to fgets, 
which always reads maximum one byte less than its size parameter.

Regards
   Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: leading_dots.patch
Type: text/x-diff
Size: 3212 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-clamav-devel/attachments/20180219/de07c9d1/attachment.patch>


More information about the Pkg-clamav-devel mailing list