]> git.baikalelectronics.ru Git - kernel.git/commit
isdn: icn: buffer overflow in icn_command()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 16 Apr 2014 11:25:16 +0000 (14:25 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Apr 2014 19:24:15 +0000 (15:24 -0400)
commit3d7a08283379cd0c13f0c5be85f4f03da2c7b9b9
treeeaae9916a4c66d1f81c31d5b876dd04fffea6260
parente890f53465ba62b03a1621f053f6cbe8a31e1aa6
isdn: icn: buffer overflow in icn_command()

This buffer over was detected using static analysis:

drivers/isdn/icn/icn.c:1325 icn_command()
error: format string overflow. buf_size: 60 length: 98

The calculation for the length of the string is off because it assumes
that the dial[] buffer holds a 50 character string, but actually it is
at most 31 characters and NUL.  I have removed the dial[] buffer because
it isn't needed.

The maximum length of the string is actually 79 characters and a NUL.  I
have made the cbuf[] array large enough to hold it and changed the
sprintf() to an snprintf() as a further safety enhancement.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/icn/icn.c