Skip to content

Commit 51bf962

Browse files
committed
Pull request 3: In Proxy.handleRequest, check error before dereferencing request
Merge in GO/gomitmproxy from stevevls-fix-segfault-on-untrusted-cert to master Squashed commit of the following: commit 65b016c Author: Steve van Loben Sels <svanlobensels@rippling.com> Date: Fri Oct 20 12:03:41 2023 -0700 In Proxy.handleRequest, check error before dereferencing request This fixes a segfault in the case where the caller does not trust the CA
1 parent 147e33e commit 51bf962

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

proxy.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,12 @@ func (p *Proxy) handleLoop(ctx *Context) {
228228
// handleRequest reads an incoming request and processes it.
229229
func (p *Proxy) handleRequest(ctx *Context) (err error) {
230230
origReq, err := p.readRequest(ctx)
231-
232-
defer log.OnCloserError(origReq.Body, log.DEBUG)
233-
234231
if err != nil {
235232
return err
236233
}
237234

235+
defer log.OnCloserError(origReq.Body, log.DEBUG)
236+
238237
session := newSession(ctx, origReq)
239238
p.prepareRequest(origReq, session)
240239
log.Debug("id=%s: handle request %s %s", session.ID(), origReq.Method, origReq.URL.String())

0 commit comments

Comments
 (0)