bugThe nmh Mail Handling System - Bugs: bug #18656, nmh-1.2: stdio buffer issues in...

 
 

bug #18656: nmh-1.2: stdio buffer issues in m_getfld() causes truncated scan lines

Submitted by:  Craig Leres <leres>
Submitted on:  Sun 31 Dec 2006 12:06:13 AM UTC  
 
Category: BugSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: NoneOpen/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 16 Apr 2012 03:52:23 PM UTC, comment #4:

Fixed in commit 740e258c5622dfe9a98a474647d8ddc164109b2f (but done in scansbr.c, rather than m_getfld()).

Ken Hornstein <kenh>
Project Administrator
Sun 06 Apr 2008 12:05:13 AM UTC, comment #3:

Just got round to looking at this again (sorry for the appalling delay). I'm still not sure about this patch. The way I thought m_getfld() was supposed to work was that the caller had to keep calling it until the returned state wasn't BODY any more. (The caller knows how much data it's got because either (a) it's null terminated or (b) for the special case for scan msg_count is set.)

So I don't think it should make any difference whether stdio has 512 bytes in its buffer or 4096 -- in the former case you just have to go round another time or two to get enough data.

So given how critical m_getfld() is I'd rather not apply this patch until I'm definitely happy about it being the right thing.

Any chance of a more detailed set of instructions on how to reproduce?

Peter Maydell <pm215>
Project Administrator
Thu 22 Mar 2007 01:34:08 AM UTC, comment #2:

> If you can regenerate it without the stylistic/whitespace changes
> that would be helpful.


Ok but since I'm putting ~100 lines of existing code inside a loop, there will still be a lot of whitespace differences. I've attached m_getfld.c.patch2

The main thing I don't like about unifed diffs is that they're only barely human readable. Try applying the patch to a scratch file and then doing "diff -w"?

(file #12229)

Craig Leres <leres>
Wed 21 Mar 2007 12:30:22 AM UTC, comment #1:

[you've seen this comment before]

I'm afraid the patch has too many extraneous changes in it so it's hard to see what changes you've put in to actually try to fix the bug. If you can regenerate it without the stylistic/whitespace changes that would be helpful. It's certainly not going to get applied as-is.

Peter Maydell <pm215>
Project Administrator
Sun 31 Dec 2006 12:06:13 AM UTC, original submission:

The code in m_getfld() was returning only as much of the message body as was left in the stdio buffer. But when reading a NFS file the block size can be as small as 512 bytes. One symptom of this was scan lines were shorter than expected when there were a lot of headers.

The patch adds a loop and causes stdio to read another buffer if necessary to fill the callers buffer.

Craig Leres <leres>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #12229:  m_getfld.c.patch2 added by leres (7KiB - application/octet-stream)
file #11646:  m_getfld.c.patch added by leres (11KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kenh (Posted a comment)
  • -unavailable- added by pm215 (Posted a comment)
  • -unavailable- added by leres (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 16 Apr 2012 03:52:23 PM UTCkenhStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 29 Dec 2008 10:37:21 PM UTCpm215CategoryNone=>Bug
    Thu 22 Mar 2007 01:34:08 AM UTCleresAttached File-=>Added m_getfld.c.patch2, #12229
    Sun 31 Dec 2006 12:06:13 AM UTCleresAttached File-=>Added m_getfld.c.patch, #11646
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1