Commit 1b99423a authored by Kaz Ondo's avatar Kaz Ondo Committed by Facebook Github Bot

Initialize addrStorage on stack

Summary:
MemorySanitizer was failing due to uninitialized memory in the stack.

```
==596112==WARNING: MemorySanitizer: use-of-uninitialized-value
[testserver][INFO]: IOBuff received. Len = 128
    #0 0x9d4b21 in folly::SocketAddress::updateUnixAddressLength(unsigned int) xplat/folly/SocketAddress.cpp:710:7
    #1 0x9d4740 in folly::SocketAddress::setFromSockaddr(sockaddr_un const*, unsigned int) xplat/folly/SocketAddress.cpp:338:3

  Uninitialized value was created by an allocation of 'addrStorage' in the stack frame of function '_ZN5folly17AsyncServerSocket12handler
ReadyEtNS_13NetworkSocketEt'
    #0 0x7de840 in folly::AsyncServerSocket::handlerReady(unsigned short, folly::NetworkSocket, unsigned short) xplat/folly/io/async/Asyn
cServerSocket.cpp:835
```

Differential Revision: D18086738

fbshipit-source-id: f36013b157d7b34d3b29c08d4533f01be1a1a8c9
parent d32d4344
......@@ -839,7 +839,7 @@ void AsyncServerSocket::handlerReady(
for (uint32_t n = 0; n < maxAcceptAtOnce_; ++n) {
SocketAddress address;
sockaddr_storage addrStorage;
sockaddr_storage addrStorage = {};
socklen_t addrLen = sizeof(addrStorage);
sockaddr* saddr = reinterpret_cast<sockaddr*>(&addrStorage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment