fix: correctly parsing empty strings (fixes #403)

This commit is contained in:
evilsocket 2018-12-12 14:51:13 +01:00
parent 99ee5c00c4
commit 31c28f0c8d
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -15,6 +15,7 @@ func ParseCommands(line string) []string {
doubleQuoted := false doubleQuoted := false
finish := false finish := false
line = strings.Replace(line, `""`, `"<empty>"`, -1)
for _, c := range line { for _, c := range line {
switch c { switch c {
case ';': case ';':
@ -50,6 +51,7 @@ func ParseCommands(line string) []string {
} }
if finish { if finish {
buf = strings.Replace(buf, `<empty>`, `""`, -1)
args = append(args, buf) args = append(args, buf)
finish = false finish = false
buf = "" buf = ""
@ -57,6 +59,7 @@ func ParseCommands(line string) []string {
} }
if len(buf) > 0 { if len(buf) > 0 {
buf = strings.Replace(buf, `<empty>`, `""`, -1)
args = append(args, buf) args = append(args, buf)
} }