Skip to content

Commit

Permalink
Issue #50: bash-engine: Make sure the heredoc-marker is a word
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKagstrom committed Jan 14, 2015
1 parent 46c4aff commit 21ba53f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/engines/bash-engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ class BashEngine : public ScriptEngineBase
// Skip << and remove spaces before and after "EOF"
heredocMarker = trim_string(s.substr(heredocStart + 2, s.size()));

// Make sure the heredoc marker is a word
for (unsigned int i = 0; i < heredocMarker.size(); i++) {
if (heredocMarker[i] == ' ' || heredocMarker[i] == '\t') {
heredocMarker = heredocMarker.substr(0, i);
break;
}
}

if (heredocMarker.size() > 0 && heredocMarker[0] != '<')
state = heredoc;
}
Expand Down

0 comments on commit 21ba53f

Please sign in to comment.