af_unix: prevent oob writes

Fixes: Coverity 1473309 Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 1454e5d9
...@@ -218,7 +218,7 @@ again: ...@@ -218,7 +218,7 @@ again:
* which exceeds the kernel limit we know about so * which exceeds the kernel limit we know about so
* close them and return an error. * close them and return an error.
*/ */
if (num_raw > KERNEL_SCM_MAX_FD) { if (num_raw >= KERNEL_SCM_MAX_FD) {
for (idx = 0; idx < num_raw; idx++) for (idx = 0; idx < num_raw; idx++)
close(fds_raw[idx]); close(fds_raw[idx]);
......
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