Skip to content

Commit

Permalink
fix: correctly parsing empty strings (fixes #403)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Dec 12, 2018
1 parent 99ee5c0 commit 31c28f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions session/session_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func ParseCommands(line string) []string {
doubleQuoted := false
finish := false

line = strings.Replace(line, `""`, `"<empty>"`, -1)
for _, c := range line {
switch c {
case ';':
Expand Down Expand Up @@ -50,13 +51,15 @@ func ParseCommands(line string) []string {
}

if finish {
buf = strings.Replace(buf, `<empty>`, `""`, -1)
args = append(args, buf)
finish = false
buf = ""
}
}

if len(buf) > 0 {
buf = strings.Replace(buf, `<empty>`, `""`, -1)
args = append(args, buf)
}

Expand Down

0 comments on commit 31c28f0

Please sign in to comment.