Skip to content

Commit

Permalink
Don't trim printable characters
Browse files Browse the repository at this point in the history
Fix SEGV when passing a destination header line containing only non-alphanumeric characters
  • Loading branch information
ffurano committed Jul 12, 2016
1 parent 082b81c commit ff6ae86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/XrdHttp/XrdHttpReq.cc
Expand Up @@ -88,11 +88,11 @@
void trim(std::string &str)
{
// Trim leading non-letters
while(str.size() && !isalnum(str[0])) str.erase(str.begin());
while( str.size() && !isgraph(str[0]) ) str.erase(str.begin());

// Trim trailing non-letters

while(str.size() && !isalnum(str[str.size()-1]))
while( str.size() && !isgraph(str[str.size()-1]) )
str.resize (str.size () - 1);

}
Expand Down Expand Up @@ -160,7 +160,7 @@ int XrdHttpReq::parseLine(char *line, int len) {
char *val = line + pos + 1;

// Trim left
while (!isalnum(*val) || (!*val)) val++;
while ( (!isgraph(*val) || (!*val)) && (val < line+len)) val++;

// Here we are supposed to initialize whatever flag or variable that is needed
// by looking at the first token of the line
Expand Down

0 comments on commit ff6ae86

Please sign in to comment.