Staging: ozwpan: prevent bogus dereference

app_id comes from the network and can't be trusted.  If it's zero then
it will lead to a kernel crash.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Chris Kelly <ckelly@ozmodevices.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter 2012-03-02 09:59:55 +03:00 committed by Greg Kroah-Hartman
parent f2e332662b
commit 92a6253299
1 changed files with 1 additions and 1 deletions

View File

@ -806,7 +806,7 @@ void oz_apps_term(void)
void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt)
{
struct oz_app_if *ai;
if (app_id > OZ_APPID_MAX)
if (app_id == 0 || app_id > OZ_APPID_MAX)
return;
ai = &g_app_if[app_id-1];
ai->rx(pd, elt);