Thank your for your comments. I revised CL to focus on the issue related a ...
11 years, 10 months ago
(2012-07-22 14:01:34 UTC)
#5
Thank your for your comments. I revised CL to focus on the issue
related a datagram, unconnected socket. Please take another look.
On Fri, Jul 20, 2012 at 2:07 PM, <dave@cheney.net> wrote:
> Thank you for fixing this issue. I'm not keen on those empty sentinel
> values, is there a way to avoid using them ?
I guess, there's no way to avoid nil pointer dereference in method chain
calls without method holders.
On 2012/07/30 01:23:43, rsc wrote: > Thanks for looking into this. I think I helped ...
11 years, 9 months ago
(2012-08-07 14:18:47 UTC)
#8
On 2012/07/30 01:23:43, rsc wrote:
> Thanks for looking into this. I think I helped someone else with this offline
> recently too. I am all for making RemoteAddr always return non-nil, but I
think
> we should do it without requiring Getsockname and Getpeername to succeed
always.
> Sockets are strange enough that I can't promise that they will always succeed,
> and given the choice between a connection that works but returns no address
> information and a socket that closes itself, I would rather have the first.
agreed, all done, ptal.
Looks good to me, modulo the comment below. Thanks. http://codereview.appspot.com/6395055/diff/32001/src/pkg/net/sock.go File src/pkg/net/sock.go (right): http://codereview.appspot.com/6395055/diff/32001/src/pkg/net/sock.go#newcode99 src/pkg/net/sock.go:99: ...
11 years, 9 months ago
(2012-08-12 05:58:17 UTC)
#11
Looks good to me, modulo the comment below. Thanks.
http://codereview.appspot.com/6395055/diff/32001/src/pkg/net/sock.go
File src/pkg/net/sock.go (right):
http://codereview.appspot.com/6395055/diff/32001/src/pkg/net/sock.go#newcode99
src/pkg/net/sock.go:99: )
You can use typed nils instead of sentinels here:
func nullProtocolAddr(f, t int) Addr {
switch f {
case syscall.AF_INET, syscall.AF_INET6:
switch t {
case syscall.SOCK_STREAM:
return (*TCPAddr)(nil)
case syscall.SOCK_DGRAM:
return (*UDPAddr)(nil)
case syscall.SOCK_RAW:
return (*IPAddr)(nil)
}
case syscall.AF_UNIX:
switch t {
case syscall.SOCK_STREAM, syscall.SOCK_DGRAM,
syscall.SOCK_SEQPACKET:
return (*UnixAddr)(nil)
}
}
panic("unreachable")
}
On Sun, Aug 12, 2012 at 2:58 PM, <dave@cheney.net> wrote: > You can use typed ...
11 years, 9 months ago
(2012-08-12 06:22:32 UTC)
#12
On Sun, Aug 12, 2012 at 2:58 PM, <dave@cheney.net> wrote:
> You can use typed nils instead of sentinels here:
Nice catch. I thought that those placeholders might be useful
for fixing issue 3838, but should be another CL. Thanks.
LGTM. My only remaining comment would be to consider if it is possible to replace ...
11 years, 9 months ago
(2012-08-12 06:52:09 UTC)
#14
LGTM. My only remaining comment would be to consider if it is possible to
replace the multiple occurrences of this
+ if lsa, _ := syscall.Getsockname(s); lsa == nil {
+ laddr = nullProtocolAddr(fd.family, fd.sotype)
+ } else {
+ laddr = toAddr(lsa)
+ }
With a helper method.
Sorry for the delayed review. I'm not sure about this. http://codereview.appspot.com/6395055/diff/39001/src/pkg/net/fd.go File src/pkg/net/fd.go (right): http://codereview.appspot.com/6395055/diff/39001/src/pkg/net/fd.go#newcode618 ...
11 years, 8 months ago
(2012-08-31 11:09:52 UTC)
#19
Issue 6395055: code review 6395055: net: avoid nil pointer dereference when RemoteAddr.Stri...
(Closed)
Created 11 years, 10 months ago by mikio
Modified 11 years, 8 months ago
Reviewers: rsc
Base URL:
Comments: 12