From: Corinna Vinschen Date: Thu, 29 Apr 2021 18:04:24 +0000 (+0200) Subject: Cygwin: POSIX mq: only allo priority up to MQ_PRIO_MAX - 1 X-Git-Tag: cygwin-3_3_0-release~228 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=4f89f24fbeb5ccfbd7077878a5342bf62f722917;p=newlib-cygwin.git Cygwin: POSIX mq: only allo priority up to MQ_PRIO_MAX - 1 POSIX requires that message priorities range from 0 (low) to sysconf(_SC_MQ_PRIO_MAX) - 1 (high). Cygwin's mq_send erroneously allowed a message priority of sysconf(_SC_MQ_PRIO_MAX). Fix it. Signed-off-by: Corinna Vinschen --- diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc index eec9ffe63..c6a003c37 100644 --- a/winsup/cygwin/posix_ipc.cc +++ b/winsup/cygwin/posix_ipc.cc @@ -798,7 +798,7 @@ _mq_send (mqd_t mqd, const char *ptr, size_t len, unsigned int prio, set_errno (EBADF); __leave; } - if (prio > MQ_PRIO_MAX) + if (prio >= MQ_PRIO_MAX) { set_errno (EINVAL); __leave;