]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - fs/cifs/cifssmb.c
cifs: fix name parsing in CIFSSMBQAllEAs
[mirror_ubuntu-hirsute-kernel.git] / fs / cifs / cifssmb.c
index 1a9fe7f816d1b83dd630141412d3dd109b23a385..0580da1cf34c549b2f34a9e43a657471097d3fe9 100644 (file)
@@ -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)