Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset f7d6b30 in mainline


Ignore:
Timestamp:
2011-09-08T19:17:27Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
5f509cc
Parents:
fb7e5a9a
Message:

Fix a bug that will corrupt the directory entry when creating files/dirs using the maximum file name lenght

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/mfs/mfs_dentry.c

    rfb7e5a9a rf7d6b30  
    7676                d_info->d_inum = conv32(sbi->native, d3->d_inum);
    7777                memcpy(d_info->d_name, d3->d_name, MFS3_MAX_NAME_LEN);
     78                d_info->d_name[MFS3_MAX_NAME_LEN] = 0;
    7879        } else {
    7980                const int namelen = longnames ? MFS_L_MAX_NAME_LEN :
     
    8687                d_info->d_inum = conv16(sbi->native, d->d_inum);
    8788                memcpy(d_info->d_name, d->d_name, namelen);
     89                d_info->d_name[namelen] = 0;
    8890        }
    8991
     
    249251        d_info.d_inum = d_inum;
    250252        memcpy(d_info.d_name, d_name, name_len);
    251         d_info.d_name[name_len] = 0;
     253        if (name_len < sbi->max_name_len)
     254                d_info.d_name[name_len] = 0;
    252255
    253256        r = mfs_write_dentry(&d_info);
Note: See TracChangeset for help on using the changeset viewer.