]> git.baikalelectronics.ru Git - kernel.git/commit
Fix vsnprintf off-by-one bug
authorLinus Torvalds <torvalds@g5.osdl.org>
Thu, 29 Jun 2006 00:09:34 +0000 (17:09 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 29 Jun 2006 00:09:34 +0000 (17:09 -0700)
commit3c99834bef676b187c3f3593d2f4547edf1d7520
tree3347213ad162a9570d6f4c5cffa1f8db7abb7cba
parenta60951ccf944fad243066bb3791fe54e0698ea1e
Fix vsnprintf off-by-one bug

The recent vsnprintf() fix introduced an off-by-one, and it's now
possible to overrun the target buffer by one byte.

The "end" pointer points to past the end of the buffer, so if we
have to truncate the result, it needs to be done though "end[-1]".

[ This is just an alternate and simpler patch to one proposed by Andrew
  and Jeremy, who actually noticed the problem ]

Acked-by: Andrew Morton <akpm@osdl.org>
Acked-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
lib/vsprintf.c