[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <538CFF22.5020800@imap.cc>
Date: Tue, 03 Jun 2014 00:48:02 +0200
From: Tilman Schmidt <tilman@...p.cc>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Karsten Keil <isdn@...ux-pingi.de>, netdev@...r.kernel.org
Subject: Re: [bug report] buffer overflow in isdn capi
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello all,
on 01.04.2014 17:48, Dan Carpenter wrote:
> The command_2_index() function is buggy and leads to a buffer
> overflow. Does anyone know how to fix this?
AFAICS this is still unfixed.
As an easy fix I propose:
- --- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -203,14 +203,7 @@ static unsigned char *cpars[] =
/*-------------------------------------------------------*/
static unsigned command_2_index(unsigned c, unsigned sc)
{
- - if (c & 0x80)
- - c = 0x9 + (c & 0x0f);
- - else if (c <= 0x0f);
- - else if (c == 0x41)
- - c = 0x9 + 0x1;
- - else if (c == 0xff)
- - c = 0x00;
- - return (sc & 3) * (0x9 + 0x9) + c;
+ return (sc & 3) * (0x9 + 0x9) + ((c & 0xf0) ? 0x9 : 0) + (c &
0x0f);
}
/*-------------------------------------------------------*/
This produces identical results to the current function for
all legal values of c (0x00..0x08, 0x41, 0x80..0x88, 0xff)
and guarantees that the result is <= 0x4e for all possible
inputs, whether legal or not. It also makes it clearer what
that function actually does.
Unless somebody points out a serious flaw with this I'll test it
and submit a formal patch.
Karsten's other concern about unhandled NULL pointers in the
mnames[] and cpars[] arrays should be addressed separately IMHO.
Regards,
Tilman
- --
Tilman Schmidt E-Mail: tilman@...p.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlOM/yIACgkQQ3+did9BuFuwMwCfVZq5Lx0P+ddhe/5WlxuO5zzp
VV4AoIn50I1wa4r4DtWfHFErMysgjsxr
=k/+h
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists