Message ID | edcc5f9dc39309d32f4b3737e6b750ae967f5bbd.1408712881.git.riku.voipio@linaro.org |
---|---|
State | Accepted |
Commit | edcc5f9dc39309d32f4b3737e6b750ae967f5bbd |
Headers | show |
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e754dbb..2549249 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2879,12 +2879,16 @@ struct target_msgbuf { }; static inline abi_long do_msgsnd(int msqid, abi_long msgp, - unsigned int msgsz, int msgflg) + ssize_t msgsz, int msgflg) { struct target_msgbuf *target_mb; struct msgbuf *host_mb; abi_long ret = 0; + if (msgsz < 0) { + return -TARGET_EINVAL; + } + if (!lock_user_struct(VERIFY_READ, target_mb, msgp, 0)) return -TARGET_EFAULT; host_mb = malloc(msgsz+sizeof(long));