From 22b1d10d31dfa31da14171c4eebd599dcd4523fc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 08:18:13 +0000 Subject: Bump github.com/containers/buildah from 1.16.4 to 1.16.5 Bumps [github.com/containers/buildah](https://github.com/containers/buildah) from 1.16.4 to 1.16.5. - [Release notes](https://github.com/containers/buildah/releases) - [Changelog](https://github.com/containers/buildah/blob/master/CHANGELOG.md) - [Commits](https://github.com/containers/buildah/compare/v1.16.4...v1.16.5) Signed-off-by: dependabot-preview[bot] Signed-off-by: Daniel J Walsh --- .../openshift/imagebuilder/shell_parser.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'vendor/github.com/openshift/imagebuilder/shell_parser.go') diff --git a/vendor/github.com/openshift/imagebuilder/shell_parser.go b/vendor/github.com/openshift/imagebuilder/shell_parser.go index 65f1db6dc..5c461a34a 100644 --- a/vendor/github.com/openshift/imagebuilder/shell_parser.go +++ b/vendor/github.com/openshift/imagebuilder/shell_parser.go @@ -7,6 +7,7 @@ package imagebuilder // be added by adding code to the "special ${} format processing" section import ( + "errors" "fmt" "strings" "text/scanner" @@ -119,7 +120,7 @@ func (sw *shellWord) processStopOn(stopChar rune) (string, []string, error) { if stopChar != scanner.EOF && ch == stopChar { sw.scanner.Next() - break + return result, words.getWords(), nil } if fn, ok := charFuncMapping[ch]; ok { // Call special processing func for certain chars @@ -156,6 +157,10 @@ func (sw *shellWord) processStopOn(stopChar rune) (string, []string, error) { } } + if stopChar != scanner.EOF { + return "", []string{}, fmt.Errorf("unexpected end of statement while looking for matching %s", string(stopChar)) + } + return result, words.getWords(), nil } @@ -168,9 +173,12 @@ func (sw *shellWord) processSingleQuote() (string, error) { for { ch := sw.scanner.Next() - if ch == '\'' || ch == scanner.EOF { + if ch == '\'' { break } + if ch == scanner.EOF { + return "", errors.New("unexpected end of statement while looking for matching single-quote") + } result += string(ch) } @@ -184,12 +192,15 @@ func (sw *shellWord) processDoubleQuote() (string, error) { sw.scanner.Next() - for sw.scanner.Peek() != scanner.EOF { + for { ch := sw.scanner.Peek() if ch == '"' { sw.scanner.Next() break } + if ch == scanner.EOF { + return "", errors.New("unexpected end of statement while looking for matching double-quote") + } if ch == '$' { tmp, err := sw.processDollar() if err != nil { @@ -206,8 +217,8 @@ func (sw *shellWord) processDoubleQuote() (string, error) { continue } - if chNext == '"' || chNext == '$' { - // \" and \$ can be escaped, all other \'s are left as-is + if chNext == '"' || chNext == '$' || chNext == '\\' { + // \" and \$ and \\ can be escaped, all other \'s are left as-is ch = sw.scanner.Next() } } -- cgit v1.2.3-54-g00ecf