]> Git Repo - linux.git/commit
exec.c, compat.c: fix count(), compat_count() bounds checking
authorJason Baron <[email protected]>
Thu, 16 Oct 2008 05:01:52 +0000 (22:01 -0700)
committerLinus Torvalds <[email protected]>
Thu, 16 Oct 2008 18:21:32 +0000 (11:21 -0700)
commit362e6663ef2369d77251496d865ad02a2376f962
tree48155cf15d85a303623a3f672f719652b0585178
parent9679e4dd628743b9ef4375d60ae69923c3766173
exec.c, compat.c: fix count(), compat_count() bounds checking

With MAX_ARG_STRINGS set to 0x7FFFFFFF, and being passed to 'count()' and
compat_count(), it would appear that the current max bounds check of
fs/exec.c:394:

if(++i > max)
return -E2BIG;

would never trigger. Since 'i' is of type int, so values would wrap and the
function would continue looping.

Simple fix seems to be chaning ++i to i++ and checking for '>='.

Signed-off-by: Jason Baron <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Cc: "Ollie Wild" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/compat.c
fs/exec.c
This page took 0.054458 seconds and 4 git commands to generate.