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

Unified Diff: sandbox/linux/seccomp/socketcall.cc

Issue 597023: linux: turn on -Wextra (Closed)
Patch Set: more Created 10 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 | « sandbox/linux/seccomp/sandbox_impl.h ('k') | sandbox/linux/suid/linux_util.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/seccomp/socketcall.cc
diff --git a/sandbox/linux/seccomp/socketcall.cc b/sandbox/linux/seccomp/socketcall.cc
index 43116bb363884d678caeda5643616f7e8f4256f1..497e5e20a5b684b78450313c735adcf153a73f65 100644
--- a/sandbox/linux/seccomp/socketcall.cc
+++ b/sandbox/linux/seccomp/socketcall.cc
@@ -288,8 +288,7 @@ bool Sandbox::process_sendmsg(int parentMapsFd, int sandboxFd, int threadFdPub,
die("Failed to read parameters for sendmsg() [process]");
}
- if (data.msg.msg_namelen < 0 || data.msg.msg_namelen > 4096 ||
- data.msg.msg_controllen < 0 || data.msg.msg_controllen > 4096) {
+ if (data.msg.msg_namelen > 4096 || data.msg.msg_controllen > 4096) {
die("Unexpected size for socketcall() payload [process]");
}
char extra[data.msg.msg_namelen + data.msg.msg_controllen];
@@ -767,7 +766,7 @@ bool Sandbox::process_socketcall(int parentMapsFd, int sandboxFd,
// Verify that the length for the payload is reasonable. We don't want to
// blow up our stack, and excessive (or negative) buffer sizes are almost
// certainly a bug.
- if (numExtraData < 0 || numExtraData > 4096) {
+ if (numExtraData > 4096) {
die("Unexpected size for socketcall() payload [process]");
}
@@ -783,8 +782,7 @@ bool Sandbox::process_socketcall(int parentMapsFd, int sandboxFd,
ssize_t numSendmsgExtra = 0;
if (socketcall_req.call == SYS_SENDMSG) {
struct msghdr* msg = reinterpret_cast<struct msghdr*>(extra);
- if (msg->msg_namelen < 0 || msg->msg_namelen > 4096 ||
- msg->msg_controllen < 0 || msg->msg_controllen > 4096) {
+ if (msg->msg_namelen > 4096 || msg->msg_controllen > 4096) {
die("Unexpected size for socketcall() payload [process]");
}
numSendmsgExtra = msg->msg_namelen + msg->msg_controllen;
« no previous file with comments | « sandbox/linux/seccomp/sandbox_impl.h ('k') | sandbox/linux/suid/linux_util.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698