Skip to content

Commit

Permalink
add sanity check for d_name length in unlink
Browse files Browse the repository at this point in the history
  • Loading branch information
flaneur2020 committed Feb 25, 2012
1 parent 97ebbc6 commit dfb0715
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int unlink_entry(struct inode *dip, char *name, int len){
bp = bread(dip->i_dev, bn);
dep = (struct dirent *)bp->b_data;
for(j=0; j<BLK/(sizeof(struct dirent))+1; j++) {
if (0==strncmp(name, dep[j].d_name, len)){
if (len==strlen(dep[j].d_name) && 0==strncmp(name, dep[j].d_name, len)){
ino = dep[j].d_ino;
dep[j].d_ino = 0;
bwrite(bp);
Expand Down

0 comments on commit dfb0715

Please sign in to comment.