Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix findGoBin panic when /usr/local contains folders with one char e.… #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prutonis
Copy link

In the scenario where '/usr/local' contains a directory with a name consisting of only a single character e.g. /usr/local/n/, the findGoBin function ends with a panic.

go run ./start/start.go -env ./cfg/env.yaml

Generating `config/env.yaml` and exiting.

panic: runtime error: slice bounds out of range [:2] with length 1

goroutine 1 [running]:
main.findGoBin(0xc00015dd10, {0x5b1811, 0xa})
        /home/dac/Sources/go/OS-NVR/start/start.go:261 +0x1e8
main.configData({0xc00016a060, 0x28})
        /home/dac/Sources/go/OS-NVR/start/start.go:239 +0x85
main.genConfigFile({0xc00016a060, 0x28})
        /home/dac/Sources/go/OS-NVR/start/start.go:208 +0x171
main.start()
        /home/dac/Sources/go/OS-NVR/start/start.go:58 +0x3d9
main.main()
        /home/dac/Sources/go/OS-NVR/start/start.go:30 +0x13
exit status 2

@Curid
Copy link
Contributor

Curid commented Apr 16, 2024

Thanks! Sorry it took so long, GitHub didn't send me a notification.

https://codeberg.org/Curid/os-nvr/commit/d3a95fb2fdeb500ba051c315068c53c461b8a462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants