]> git.karo-electronics.de Git - karo-tx-linux.git/commit
cifs: Fix incorrect destination buffer size in cifs_strncpy_to_host
authorSuresh Jayaraman <sjayaraman@suse.de>
Sat, 9 May 2009 05:56:44 +0000 (11:26 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 18 May 2009 23:34:58 +0000 (16:34 -0700)
commit9381701c0f0722ffc1dab1c55ecd48f6d0b5be6f
treed62500cc8dfc38e9f931d81184c97f64ea36efe5
parente9012cf5e92b7812f5fc88fdd1ddaecc34a5b904
cifs: Fix incorrect destination buffer size in cifs_strncpy_to_host

Relevant commits 968460ebd8006d55661dec0fb86712b40d71c413 and
066ce6899484d9026acd6ba3a8dbbedb33d7ae1b. Minimal hunks to fix buffer
size and fix an existing problem pointed out by Guenter Kukuk that length
of src is used for NULL termination of dst.

cifs: Rename cifs_strncpy_to_host and fix buffer size

There is a possibility for the path_name and node_name buffers to
overflow if they contain charcters that are >2 bytes in the local
charset. Resize the buffer allocation so to avoid this possibility.

Also, as pointed out by Jeff Layton, it would be appropriate to
rename the function to cifs_strlcpy_to_host to reflect the fact
that the copied string is always NULL terminated.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/cifssmb.c