aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2003-10-22 13:51:46 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2003-10-22 13:51:46 +0000
commit5dcb3762e044be0675993baab8f177018b9678d4 (patch)
tree3fb4b4282acc6900a52cf6fdeb3ed22cad0d0278
parenta13293f19f7400c87ee08b43b4032405b13cb843 (diff)
downloadsrc-5dcb3762e044be0675993baab8f177018b9678d4.tar.gz
src-5dcb3762e044be0675993baab8f177018b9678d4.zip
MFC linux_misc.c 1.149, linux_uid16.c 1.12: Reject negative ngrp arguments
in linux_setgroups() and linux_setgroups16(). Approved by: re (murray)
Notes
Notes: svn path=/stable/4/; revision=121338
-rw-r--r--sys/compat/linux/linux_misc.c2
-rw-r--r--sys/compat/linux/linux_uid16.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 661919ef1a3b..758d882a001d 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -979,7 +979,7 @@ linux_setgroups(struct proc *p, struct linux_setgroups_args *args)
if ((error = suser_xxx(oldcred, NULL, PRISON_ROOT)) != 0)
return (error);
- if (ngrp >= NGROUPS)
+ if (ngrp < 0 || ngrp >= NGROUPS)
return (EINVAL);
newcred = crdup(oldcred);
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index 74fb0568aa47..3f2f3bd098b6 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -111,7 +111,7 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args)
if ((error = suser_xxx(oldcred, NULL, PRISON_ROOT)) != 0)
return (error);
- if (ngrp >= NGROUPS)
+ if (ngrp < 0 || ngrp >= NGROUPS)
return (EINVAL);
newcred = crdup(oldcred);