goodhosts / cli

Simple hosts file management in a Go cli
MIT License
29 stars 8 forks source link

Crosspost: https://github.com/goodhosts/hostsfile/issues/39 #36

Closed yunginnanet closed 1 year ago

yunginnanet commented 2 years ago

See https://github.com/goodhosts/hostsfile/issues/39

[...]

hosts r ff00::0

Version[s] reproduced with

(Using goodhosts/cli in all cases)

* [x]  Vendored copy that comes with [goodhosts/cli](https://github.com/goodhosts/cli)

* [x]  Latest release

* [x]  Main branch

[...]

removing ip ff00::0
panic: runtime error: slice bounds out of range [5:3]

goroutine 1 [running]:
github.com/goodhosts/hostsfile.(*Hosts).removeByPosition(...)
  /home/kayos/go/pkg/mod/github.com/goodhosts/hostsfile@v0.1.1/hosts.go:390
github.com/goodhosts/hostsfile.(*Hosts).RemoveByIp(0xc0002f0770, {0x7fff5401b761?, 0x660254?})
  /home/kayos/go/pkg/mod/github.com/goodhosts/hostsfile@v0.1.1/hosts.go:282 +0x1ff
github.com/goodhosts/cli/cmd.processSingleArg(0xc00029fae8?, {0x7fff5401b761, 0x7})
  /home/kayos/Workshop/goodhosts/cli/cmd/remove.go:97 +0xa9
github.com/goodhosts/cli/cmd.remove(0xc0002ee500)
  /home/kayos/Workshop/goodhosts/cli/cmd/remove.go:45 +0x145
github.com/urfave/cli/v2.(*Command).Run(0xc0001aab40, 0xc0002ee340)
  /home/kayos/go/pkg/mod/github.com/urfave/cli/v2@v2.6.0/command.go:163 +0x5bb
github.com/urfave/cli/v2.(*App).RunContext(0xc0001a4d00, {0x6c90d8?, 0xc0000140b0}, {0xc000010180, 0x3, 0x3})
  /home/kayos/go/pkg/mod/github.com/urfave/cli/v2@v2.6.0/app.go:313 +0xb48
github.com/urfave/cli/v2.(*App).Run(...)
  /home/kayos/go/pkg/mod/github.com/urfave/cli/v2@v2.6.0/app.go:224
main.main()
  /home/kayos/Workshop/goodhosts/cli/main.go:59 +0x414

I believe the issue primarily exists in this tool.

luthermonson commented 1 year ago

fixed by #37