commit - 5740e5eef190ea7e2a372f6c5da31c40910fe507
commit + 64b08e1e5fe43e66f9ec1e54408492907975b724
blob - ef73037cc9d6f7a5afef4090b30f7e5fb2bc9e5b
blob + 2c65b272dda9d6e1bc870a40e60b4740d887f46b
--- internal/sip/sip.go
+++ internal/sip/sip.go
return line, fmt.Errorf("expected 3 fields, read %d", len(fields))
}
for i, s := range fields {
- for _, r := range s {
- if unicode.IsSpace(r) {
- return line, fmt.Errorf("illegal space character in field %d", i)
- }
+ if containsSpace(s) {
+ return line, fmt.Errorf("illegal space character in field %d", i)
}
}
return [3]string{fields[0], fields[1], fields[2]}, nil
}
+func containsSpace(s string) bool {
+ for _, r := range s {
+ if unicode.IsSpace(r) {
+ return true
+ }
+ }
+ return false
+}
+
type CommandSequence struct {
Number int
Method string