Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4731)

Unified Diff: base/posix/unix_domain_socket_linux.cc

Issue 196353002: ensure that UnixDomainSocket::RecvMsgWithFlags doesn't memcpy from 0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/posix/unix_domain_socket_linux.cc
diff --git a/base/posix/unix_domain_socket_linux.cc b/base/posix/unix_domain_socket_linux.cc
index 757db983cd09dcf7d6cd293fe5d668927d619db4..436c337adb4f4e151666be2ac7d86d03458ae97a 100644
--- a/base/posix/unix_domain_socket_linux.cc
+++ b/base/posix/unix_domain_socket_linux.cc
@@ -106,8 +106,10 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd,
return -1;
}
- fds->resize(wire_fds_len);
- memcpy(vector_as_array(fds), wire_fds, sizeof(int) * wire_fds_len);
+ if (wire_fds) {
+ fds->resize(wire_fds_len);
+ memcpy(vector_as_array(fds), wire_fds, sizeof(int) * wire_fds_len);
+ }
return r;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698