Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic occurs when fetching messaging service for SID with trailing whitespace #193

Closed
apobletts opened this issue Oct 13, 2022 · 2 comments
Labels
status: waiting for feedback waiting for feedback from the submitter type: bug bug in the library

Comments

@apobletts
Copy link

Issue Summary

I use the following code to check if a messaging service is valid

_, err = twilioClient.MessagingV1.FetchService(p.TwilioConfig.MessagingServiceSid)
if err != nil {
  // handle error
}

If the MessageService SID contains trailing whitespace, then the library produces a panic.

Steps to Reproduce

  1. Create a Twilio Client
  2. Fetch Messaging Service with Messaging Service SID that has trailing whitespace

Code Snippet

_, err = twilioClient.MessagingV1.FetchService("MSabc123\t")
if err != nil {
  // handle error
}

Exception/Log

2022/10/13 15:15:12 http: panic serving 172.24.0.1:57074: runtime error: invalid memory address or nil pointer dereference
goroutine 69 [running]:
net/http.(*conn).serve.func1()
       /usr/local/go/src/net/http/server.go:1825 +0xbf
panic({0x113d760, 0x1ccfd00})
github.com/twilio/twilio-go/client.(*RequestHandler).BuildUrl(0xc00081b620, {0xc000098000?, 0xc000556e18?})
       /go/pkg/mod/github.com/twilio/twilio-go@v0.18.2/client/request_handler.go:37 +0x4a
github.com/twilio/twilio-go/client.(*RequestHandler).sendRequest(0xc00081b620, {0x130c879, 0x3}, {0xc000098000?, 0xc000120450?}, 0x23?, 0xffffffffffffffff?)
       /go/pkg/mod/github.com/twilio/twilio-go@v0.18.2/client/request_handler.go:27 +0x3d
github.com/twilio/twilio-go/client.(*RequestHandler).Get(...)
       /go/pkg/mod/github.com/twilio/twilio-go@v0.18.2/client/request_handler.go:83
github.com/twilio/twilio-go/rest/messaging/v1.(*ApiService).FetchService(0xc00051c2a0, {0xc000120450?, 0xc000556f78?})
       /go/pkg/mod/github.com/twilio/twilio-go@v0.18.2/rest/messaging/v1/services.go:219 +0xfc

Technical details:

  • twilio-go version: v0.18.2
@beebzz
Copy link

beebzz commented Oct 14, 2022

Hi @apobletts, thanks for submitting an issue. I'm unable to reproduce this using the latest version of twilio-go (1.0.0). Have you tried upgrading to 1.0.0 then seeing if the whitespaces break the request?

@beebzz beebzz added status: waiting for feedback waiting for feedback from the submitter type: bug bug in the library labels Oct 14, 2022
@apobletts
Copy link
Author

Hi @beebzz . It does looks like I can only reproduce in 0.18.2, but not in 1.0.0. I will upgrade. Thank you!

@beebzz beebzz closed this as completed Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for feedback waiting for feedback from the submitter type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants