]> git.baikalelectronics.ru Git - kernel.git/commit
ISDN: pcbit: off by one bugs in pcbit_set_msn()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 31 Jul 2014 15:30:11 +0000 (18:30 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Aug 2014 05:14:54 +0000 (22:14 -0700)
commit4d16e529b70d16f275ab5b39c1d25c224a90f19a
tree669276e7cbc4f83d0c79d77ef2cff9dcc318fef4
parent56a967e8e2d69724de7ab441b77cdaedb26334fd
ISDN: pcbit: off by one bugs in pcbit_set_msn()

1) We don't allocate enough space for the NUL terminator so we end up
   corrupting one character beyond the end of the buffer.

2) The "len - 1" should just be "len".  The code is trying to copy a
   word from a buffer up to a comma or the last word in the buffer.
   Say you have the buffer, "foo,bar,baz", then this code truncates the
   last letter off each word so you get "fo", "ba", and "ba".  You would
   hope this kind of bug would get noticed in testing...

   I'm not very familiar with this code and I can't test it, but I think
   we should copy the final character.

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