fix: handle invalid KinfoProc size on BSD systems

pull/1694/head
Slawek Figiel 7 months ago
parent e8aa2144bd
commit 977269202e

@ -6,6 +6,7 @@ package process
import ( import (
"bytes" "bytes"
"context" "context"
"errors"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
@ -329,7 +330,7 @@ func (p *Process) getKProc() (*KinfoProc, error) {
return nil, err return nil, err
} }
if length != sizeOfKinfoProc { if length != sizeOfKinfoProc {
return nil, err return nil, errors.New("unexpected size of KinfoProc")
} }
k, err := parseKinfoProc(buf) k, err := parseKinfoProc(buf)

@ -7,6 +7,7 @@ import (
"bytes" "bytes"
"context" "context"
"encoding/binary" "encoding/binary"
"errors"
"fmt" "fmt"
"io" "io"
"path/filepath" "path/filepath"
@ -343,7 +344,7 @@ func (p *Process) getKProc() (*KinfoProc, error) {
return nil, err return nil, err
} }
if length != sizeOfKinfoProc { if length != sizeOfKinfoProc {
return nil, err return nil, errors.New("unexpected size of KinfoProc")
} }
k, err := parseKinfoProc(buf) k, err := parseKinfoProc(buf)

Loading…
Cancel
Save