nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] corruption when attaching all-null files


From: Paul Fox
Subject: Re: [Nmh-workers] corruption when attaching all-null files
Date: Wed, 07 May 2014 15:49:40 -0400

ken wrote:
 > >ken wrote:
 > > > >A file of all \0 wouldn't match any of these cases (contains8bit only
 > > > >gets set if the function fails isascii(), which is between 0 and 127.).
 > > > >I think we need a new test (isvalid7bit?  Have to think about it).
 > > > 
 > > > Also ... we use fgets() to read in the file we're scanning.  We'll fail
 > > > with NULs when it comes to that.  It looks like we should be using
 > > > getline() instead.  Is that pretty common nowadays?  Looks like it's
 > >
 > >i'm completely unfamiliar with the code paths in question, but if
 > >we're reading an arbitrary file, shouldn't we just use fread()?
 > 
 > Sigh.  You'd THINK that.  But in practice it's hard.  You care about line
 > length; fgets() (used now) and getline() read input in lines.  If you used
 > fread(), you'd have to keep track of line delimiters itself.  Check out
 > scan_content() in mhbuildsbr.c.  The loop commented "Scan the unencoded
 > content" is what we're talking about.

yes, i see now.

converting that loop doesn't look too hard, as long as someone else is
taking care of making sure getline is always available.  certainly
at least part of today's bug is lurking in there.  and i think i understand
the containsnuls issue, though i'll likely be checking in again on that
one.

paul
----------------------
 paul fox, address@hidden (arlington, ma, where it's 67.1 degrees)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]