Wrong length calculation on folded lines.

Bug #1823008 reported by Lester Potter
This bug report is a duplicate of:  Bug #1823006: Wrong length calculation. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dkimpy
New
Undecided
Unassigned

Bug Description

When folding, certain values will cause the folded line to exceed 72 by 1.

In dkim/__init__.py, a recent change to fold() changed "namelen = 0" to "maxleng = 72". This changes tries to address short folded lines. However, this change can potentially result in line lengths of 73 because it does not account for the space in the prepended "\r\n ". The correct change would be "maxleng = 71"

At lines 400-409, "i" is calculated as the offset to the first space (if any). If i == 72 (and maxleng==72), then the line will be appended to a line that already has one character, the space. If i == -1 (no space found), then the line will be folded with 72 characters and appended to a line that already has one character. In both these situations, the length of the line will be 73.

Revision history for this message
Lester Potter (lesterpotter) wrote :

Correction: i cannot == 72, so that is not a problem, if i==71, then line is correctly limited to 72. If however i == -1, the problem still occurs.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.