cifs: fix length handling in cifs_get_name_from_search_buf
authorJeff Layton <jlayton@redhat.com>
Fri, 1 May 2009 00:45:45 +0000 (20:45 -0400)
committerSteve French <sfrench@us.ibm.com>
Fri, 1 May 2009 00:49:23 +0000 (00:49 +0000)
commit18295796a30cada84e933d805072dc2248d54f98
tree33bb2720165640fefc2987878a507d6797994891
parent9e39b0ae8af46c83b85dae7ff5251911a80fce5a
cifs: fix length handling in cifs_get_name_from_search_buf

The earlier patch to move this code to use the new unicode helpers
assumed that the filename strings would be null terminated. That's not
always the case.

Instead of passing "max_len" to the string converter, pass "min(len,
max_len)", which makes it do the right thing while still keeping the
parser confined to the response. Also fix up the prototypes of this
function and the callers so that max_len is unsigned (like len is).

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/readdir.c