bugcgicc - Bugs: bug #24301, CgiEnvironment constructor fails...

 
 

bug #24301: CgiEnvironment constructor fails when posts have zero length

Submitted by:  None
Submitted on:  Thu 18 Sep 2008 06:12:40 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: sebastien diaz <sebdiaz>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 18 Sep 2008 06:12:40 PM UTC, original submission:

Using visual c++ 2005 express edition on windows xp. When you execute this line:

if ( local_input.read( &data[0], getContentLength() ) != getContentLength() )

In this constructor:
CgiEnvironment(CgiInput *input)

It throws an invalid iterator exception if there's a zero length POST.

I wrapped an if statement around the code that parses the post:

// If input is 0, use the default implementation of CgiInput
if ( input == 0 )
{
if ( local_input.read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");
}
else
if ( input->read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");

fPostData = std::string( &data[0], getContentLength() );

changes to this:

if ( getContentLength() )
{
// If input is 0, use the default implementation of CgiInput
if ( input == 0 )
{
if ( local_input.read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");
}
else
if ( input->read( &data[0], getContentLength() ) != getContentLength() )
throw std::runtime_error("I/O error");

fPostData = std::string( &data[0], getContentLength() );
}

FYI - Jay Sprenkle

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

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

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 21 Jan 2009 09:15:58 PM UTCsebdiazOpen/ClosedOpen=>Closed
Sat 03 Jan 2009 01:51:23 PM UTCsebdiazStatusNone=>Fixed
Sun 21 Sep 2008 04:37:59 PM UTCsebdiazAssigned toNone=>sebdiaz

Back to the top


Powered by Savane 3.1-cleanup1