Skip to content
Commit f60d16a8 authored by Jim Meyering's avatar Jim Meyering Committed by Josef Bacik
Browse files

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: default avatarJosef Bacik <josef@redhat.com>
Signed-off-by: default avatarJim Meyering <meyering@redhat.com>
parent a27202fb
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment