From: Jim Meyering Date: Wed, 25 Apr 2012 19:24:17 +0000 (+0200) Subject: Btrfs: avoid buffer overrun in mount option handling X-Git-Tag: v3.5-rc1~17^2~1^2~20 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f60d16a8923201bb27ad7c09016abab2818cf8ce;p=pandora-kernel.git Btrfs: avoid buffer overrun in mount option handling There is an off-by-one error: allocating room for a maximal result string but without room for a trailing NUL. That, can lead to returning a transformed string that is not NUL-terminated, and then to a caller reading beyond end of the malloc'd buffer. Rewrite to s/kzalloc/kmalloc/, remove unwarranted use of strncpy (the result is guaranteed to fit), remove dead strlen at end, and change a few variable names and comments. Reviewed-by: Josef Bacik Signed-off-by: Jim Meyering --- Reading git-diff-tree failed