]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: fix off-by-one bug in build_unc_path_to_root
authorJeff Layton <jlayton@redhat.com>
Fri, 31 May 2013 14:00:18 +0000 (10:00 -0400)
committerSteve French <sfrench@us.ibm.com>
Fri, 31 May 2013 21:23:35 +0000 (16:23 -0500)
commit55112e3268afc2857533860df09944fc363e5c48
treed4066d88f8ffb3431d766d49035f1f7caa1439ed
parentd557f2378f2da68dc8df949e257ba1746c29464d
cifs: fix off-by-one bug in build_unc_path_to_root

commit c3d2f8eb15 (cifs: fix up handling of prefixpath= option) changed
the code such that the vol->prepath no longer contained a leading
delimiter and then fixed up the places that accessed that field to
account for that change.

One spot in build_unc_path_to_root was missed however. When doing the
pointer addition on pos, that patch failed to account for the fact that
we had already incremented "pos" by one when adding the length of the
prepath. This caused a buffer overrun by one byte.

This patch fixes the problem by correcting the handling of "pos".

Cc: <stable@vger.kernel.org> # v3.8+
Reported-by: Marcus Moeller <marcus.moeller@gmx.ch>
Reported-by: Ken Fallon <ken.fallon@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/connect.c