aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-07-26 18:23:47 -0400
committerSteve French <sfrench@us.ibm.com>2011-07-31 21:21:09 +0000
commit91d065c47317cd5f6577fa077cca3383c8d9243d (patch)
treeb233806b287b9b97f9c085f2e0dc280d031961ed /fs
parent998d6fcb24d25b7889ec39118cf98d5089ac4c11 (diff)
cifs: fix name parsing in CIFSSMBQAllEAs
The code that matches EA names in CIFSSMBQAllEAs is incorrect. It uses strncmp to do the comparison with the length limited to the name_len sent in the response. Problem: Suppose we're looking for an attribute named "foobar" and have an attribute before it in the EA list named "foo". The comparison will succeed since we're only looking at the first 3 characters. Fix this by also comparing the length of the provided ea_name with the name_len in the response. If they're not equal then it shouldn't match. Reported-by: Jian Li <jiali@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifssmb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 1a9fe7f816d..0580da1cf34 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -5720,6 +5720,7 @@ CIFSSMBQAllEAs(const int xid, struct cifs_tcon *tcon,
char *temp_ptr;
char *end_of_smb;
__u16 params, byte_count, data_offset;
+ unsigned int ea_name_len;
cFYI(1, "In Query All EAs path %s", searchName);
QAllEAsRetry:
@@ -5814,6 +5815,10 @@ QAllEAsRetry:
list_len -= 4;
temp_fea = ea_response_data->list;
temp_ptr = (char *)temp_fea;
+
+ if (ea_name)
+ ea_name_len = strlen(ea_name);
+
while (list_len > 0) {
unsigned int name_len;
__u16 value_len;
@@ -5837,7 +5842,8 @@ QAllEAsRetry:
}
if (ea_name) {
- if (strncmp(ea_name, temp_ptr, name_len) == 0) {
+ if (ea_name_len == name_len &&
+ strncmp(ea_name, temp_ptr, name_len) == 0) {
temp_ptr += name_len + 1;
rc = value_len;
if (buf_size == 0)