diff options
author | 2004-08-09 15:27:43 +0000 | |
---|---|---|
committer | 2004-08-09 15:27:43 +0000 | |
commit | 2158989498760047bddb4d042ab165ef6421c62a (patch) | |
tree | 71b3af3de451421636fe1385933f380752f639b4 | |
parent | Big cleanup. Removed some unused obsolete stuff and fixed copyrights (diff) | |
download | wireguard-openbsd-2158989498760047bddb4d042ab165ef6421c62a.tar.xz wireguard-openbsd-2158989498760047bddb4d042ab165ef6421c62a.zip |
Do not fill uae_error[] out of its bounds; this is especially dangerous
with the new malloc. Fix from arla-current.
ok millert@
-rw-r--r-- | usr.sbin/afs/src/lib/ko/uae.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/afs/src/lib/ko/uae.c b/usr.sbin/afs/src/lib/ko/uae.c index 45a3dbc81a8..d19381aa9b4 100644 --- a/usr.sbin/afs/src/lib/ko/uae.c +++ b/usr.sbin/afs/src/lib/ko/uae.c @@ -35,7 +35,7 @@ * Unified AFS errnos * * The idea is that we use up the et space 'uae' and 'uaf' (512 - * enteries) and use those for AFS errno's that the server can use + * entries) and use those for AFS errno's that the server can use * then the client supports the TellMeAboutYourself callbackmanager * interface. * @@ -46,7 +46,7 @@ #include "ko_locl.h" #ifdef RCSID -RCSID("$arla: uae.c,v 1.4 2003/03/07 22:43:22 lha Exp $") ; +RCSID("$arla: uae.c,v 1.5 2004/07/06 13:13:51 tol Exp $") ; #endif static int32_t *uae_array; @@ -55,8 +55,10 @@ static int uae_len; static void uae_set(int32_t errno_error, int32_t uae_error) { - assert(UAE_ERROR_base - uae_error < uae_len); - uae_array[UAE_ERROR_base - uae_error] = errno_error; + int index = uae_error - UAE_ERROR_base; + assert(index >= 0); + assert(index < uae_len); + uae_array[index] = errno_error; } /* |