commit dcfbef8d459adf916f5c4ce8c6ff4ff777be06ff Author: David Fifield david@bamsoftware.com Date: Thu Jan 11 13:04:34 2018 -0800
Show an error when missing a meek-client command line.
Running meek-client-torbrowser without arguments would panic as it tried to index the nonexistent arguments.
2018/01/11 21:02:07 running firefox command ["firefox" "--invisible" "-no-remote" "-profile" "TorBrowser/Data/Browser/profile.meek-http-helper"] 2018/01/11 21:02:07 firefox started with pid 23721 2018/01/11 21:02:08 killing PID 23721 panic: runtime error: index out of range
goroutine 1 [running]: panic(0x4e95a0, 0xc42000a110) /usr/lib/go-1.7/src/runtime/panic.go:500 +0x1a1 main.runMeekClient(0xc420010589, 0xf, 0xc42000a2c0, 0x0, 0x0, 0x0, 0x10, 0xc42000e440) meek-client-torbrowser.go:267 +0x416 main.main() meek-client-torbrowser.go:354 +0x3d2 --- meek-client-torbrowser/meek-client-torbrowser.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/meek-client-torbrowser/meek-client-torbrowser.go b/meek-client-torbrowser/meek-client-torbrowser.go index 691a566..db35080 100644 --- a/meek-client-torbrowser/meek-client-torbrowser.go +++ b/meek-client-torbrowser/meek-client-torbrowser.go @@ -296,6 +296,11 @@ func main() { log.SetOutput(f) }
+ meekClientCommandLine := flag.Args() + if len(meekClientCommandLine) == 0 { + log.Fatal("need a meek-client command line") + } + // By default, writes to file descriptor 1 and 2 when the descriptor has // been closed will terminate the program with a SIGPIPE signal. This is // a problem because the default log destination is stderr (file @@ -351,7 +356,7 @@ func main() { }
// Start meek-client with the helper address. - meekClientCmd, err := runMeekClient(helperAddr, flag.Args()) + meekClientCmd, err := runMeekClient(helperAddr, meekClientCommandLine) if err != nil { log.Print(err) return