Merge pull request #2471 from thaJeztah/19.03_backport_fix_bind_panic

[19.03 backport] fix panic on single-character volumes
This commit is contained in:
Silvin Lubecki 2020-04-30 17:31:35 +02:00 committed by GitHub
commit 62baa3ce57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -111,6 +111,9 @@ func isFilePath(source string) bool {
case '.', '/', '~':
return true
}
if len([]rune(source)) == 1 {
return false
}
// windows named pipes
if strings.HasPrefix(source, `\\`) {

View File

@ -162,6 +162,8 @@ func TestParseVolumeWindowsNamedPipe(t *testing.T) {
func TestIsFilePath(t *testing.T) {
assert.Check(t, !isFilePath("a界"))
assert.Check(t, !isFilePath("1"))
assert.Check(t, !isFilePath("c"))
}
// Preserve the test cases for VolumeSplitN