bug-cgicc
[Top][All Lists]
Advanced

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

[bug-cgicc] bug on x86_64 + patch


From: Martin Oberzalek
Subject: [bug-cgicc] bug on x86_64 + patch
Date: Tue, 22 Feb 2005 21:11:51 +0100
User-agent: KMail/1.5.4

Hello,

There is a bug in CgiUtils.cpp that effects forms with multipart/form-data on 
platforms where sizeof(unsigned) < sizeof( std::string::size_type)

// locate data between separators, and return it
std::string
cgicc::extractBetween(const std::string& data,
              const std::string& separator1,
              const std::string& separator2)
{
  std::string result;
  unsigned int start, limit;

  start = data.find(separator1, 0);
  if(start != std::string::npos) {
    start += separator1.length();
    limit = data.find(separator2, start);
    if(limit != std::string::npos)
      result = data.substr(start, limit - start);
  }

  return result;
}


Since std::string::npos is a castet -1. The if statement will always be true.

The patch below fixes this.

Greetings, Martin!

diff -r cgicc-3.2.3-p1/cgicc/Cgicc.cpp cgicc-3.2.3/cgicc/Cgicc.cpp
40d39
<
diff -r cgicc-3.2.3-p1/cgicc/CgiUtils.cpp cgicc-3.2.3/cgicc/CgiUtils.cpp
214c214
<   std::string::size_type start, limit;
---
>   unsigned int start, limit;
222,223c222,223
<   }
<
---
>   }
>

-- 
Gebrauchtwagen =>  http://www.austromobil.at
Genießen Sie die Fahrt!

Attachment: cgicc-3.2.3-x86_64-patch
Description: Text Data


reply via email to

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