@marcel91200 / caddy Mirror · read-only / commits / 4cff36d7
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

caddyauth: Use buffered channel passed to signal.Notify (#3895)

The docs at os/signal.Notify warn about this signal delivery loss bug at https://golang.org/pkg/os/signal/#Notify, which says: Package signal will not block sending to c: the caller must ensure that c has sufficient buffer space to keep up with the expected signal rate. For a channel used for notification of just one signal value, a buffer of size 1 is sufficient. Caught by a static analysis tool from Orijtech, Inc. called "sigchanyzer"

Cuong Manh Le committed Dec 1, 2020 at 22:27 UTC 4cff36d731390915649261f0e9c088be0eeafcf1
1 file changed +1 -1
modules/caddyhttp/caddyauth/command.go
+1 -1
@@ -70,7 +70,7 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
70 if terminal.IsTerminal(fd) {
71 // ensure the terminal state is restored on SIGINT
72 state, _ := terminal.GetState(fd)
73 - c := make(chan os.Signal)
73 + c := make(chan os.Signal, 1)
74 signal.Notify(c, os.Interrupt)
75 go func() {
76 <-c