mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-26 17:46:34 +03:00
Update securego/gosec from 2.23.0 to 2.25.0 (#2161)
This commit is contained in:
+14
-1
@@ -66,8 +66,14 @@ func (cfg *Config) NewListener(network, addr string) (net.Listener, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fdUintptr, err := safeIntToUintptr(fd)
|
||||
if err != nil {
|
||||
unix.Close(fd)
|
||||
return nil, fmt.Errorf("unexpected convert socket fd int to uintptr: %w", err)
|
||||
}
|
||||
|
||||
name := fmt.Sprintf("reuseport.%d.%s.%s", os.Getpid(), network, addr)
|
||||
file := os.NewFile(uintptr(fd), name)
|
||||
file := os.NewFile(fdUintptr, name)
|
||||
ln, err := net.FileListener(file)
|
||||
if err != nil {
|
||||
file.Close()
|
||||
@@ -190,3 +196,10 @@ func safeIntToUint32(i int) (uint32, error) {
|
||||
}
|
||||
return uint32(ui), nil
|
||||
}
|
||||
|
||||
func safeIntToUintptr(i int) (uintptr, error) {
|
||||
if i < 0 {
|
||||
return 0, errors.New("value is negative, cannot convert to uintptr")
|
||||
}
|
||||
return uintptr(i), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user