Subject: Strange dates (e.g. 1970)

From: Bruce Lilly <[email-masked]>
Date: Fri, 27 May 1994 12:52:41 UT

Somebody on the pine-info mailing list recently asked about the
cause of strange dates on messages. Another person replied that
he had built pine on a similar OS and had not had the problem.

The problem is data-dependent, not OS-dependent.

There's a multi-page macro in one of the c-client files that
purports to parse rmail "From " lines.  The macro author made
some rather optimistic assumptions about the format of such
lines. As a result, the macro can easily fail, resulting in the
assignment of garbage to date fields, yielding a zero (0:00 UTC
Jan. 1, 1970) date. I think the guilty file is bezerk.h, but's
that's from memory (and I haven't looked at the source in many
months), so it may be elsewhere.

For example, if the From line has some quite legal but long
fields, as in
	From a.moderately.long.domain.name.somewhere.org!user.name Fri May 13 12:34:56 1994 remote from another.moderately.long.domain.name.or.uucp.node.name
the macro will fail miserably. See RFC976 for a detailed
discussion of what might appear in a modern "From " line.

One could extend the macro to handle longer fields correctly,
but it would still be possible for the macro to fail on "From "
lines with very long fields. If the macro is sufficiently
extended to handle likely input without error, any pretense of
efficiency of a macro (assuming that it would even be compiled
correctly by most compilers) over a reasonably-coded function is
just that--a pretense.

Rewriting the macro as a function, taking care to parse
correctly in the presence of long fields, will fix the problem.
The calling sequence has to be revised as well; the simplest
solution is probably to pass the addresses of the variables into
which the parsed fields should be stored.

-- 
    Bruce Lilly, Product Manager,      | 
    Routers, Peripherals & Still Store,| uupsi!monymsys!sonyd1!bruce
    Sony, 3 Paragon Drive, Montvale,   | [email-masked]
    NJ 07645-1735  |  Telephone: +1 201 358 4161  |  FAX: +1 201 358 4274