[Mimedefang] BUG: v2.15 invalid offset useage in action_add_part

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Mon Jul 1 09:19:55 EDT 2002


Hello,

I'm not sure, whether to send bug reports here, but it will reach someone
at roaring penguin, I guess.

In MIMEDefang.pl v2.15 around line #392 (function sub action_add_part
($$$$$$;$)):

   my ($offset)      = shift;

   $offset ||= -1;

Here is assumed that if($offset == 0) no offset is specified; however, if
you want to insert the part as the very first part, you have to specify
offset 0 (in clash with the documentation (perldoc MIME::Entity):
"If OFFSET is positive, the new part is added at that
 offset from the beginning of the array of parts.  If it
 is negative, it counts from the end of the array.  (An"

Should read: "If OFFSET is non-negative" :)

Because $offset is unmodifiedly passed through to MIME::Entity->add_part,
there is probably no need to default to -1 at all, because the module does
so itself:

defined($index) or $index = -1;

So I've removed the assignment in action_add_part, what seems to work;
however, I do not know how this change effects mimedefang's _internal_
useage of this function.

To specify -9999 as offset didn't worked either; I didn't searched why,
but MIMEDefang does not rebuilt the message (no log entry), regardless of
explicitly calling action_rebuilt(). I guess, the module's add_part
function drops the request due to an invalid offset.

BTW: I discovered this bug while I fought to insert the SpamAssassin's
report as the first part, in order to prevent displaying HTML parts as
default.

Bye,

-- 

Steffen Kaiser






More information about the MIMEDefang mailing list