NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/58018: ext2fs readdir (d_type conversion error)



>Number:         58018
>Category:       kern
>Synopsis:       ext2fs readdir (d_type conversion error)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 09 19:05:00 +0000 2024
>Originator:     Damir Holovati
>Release:        trunk
>Organization:
n/a
>Environment:
>Description:
sys/ufs/ext2fs/ext2fs_dir.h:173

static __inline uint8_t
ext2dt2dt(uint8_t type)
{
	switch (type) {
	case EXT2_FT_REG_FILE:
		return DT_FIFO; <---------------- THIS IS NOT CORRECT
	case EXT2_FT_DIR:
		return DT_DIR;
	case EXT2_FT_CHRDEV:
		return DT_CHR;
	case EXT2_FT_BLKDEV:
		return DT_BLK;
	case EXT2_FT_FIFO:
		return DT_FIFO;
	case EXT2_FT_SOCK:
		return DT_SOCK;
	case EXT2_FT_SYMLINK:
		return DT_LNK;
	default:
		return DT_UNKNOWN;
	}
}

>How-To-Repeat:
Mount a ext2 volume and invoke ls.
>Fix:
static __inline uint8_t
ext2dt2dt(uint8_t type)
{
	switch (type) {
	case EXT2_FT_REG_FILE:
		return DT_REG;
	case EXT2_FT_DIR:
		return DT_DIR;
	case EXT2_FT_CHRDEV:
		return DT_CHR;
	case EXT2_FT_BLKDEV:
		return DT_BLK;
	case EXT2_FT_FIFO:
		return DT_FIFO;
	case EXT2_FT_SOCK:
		return DT_SOCK;
	case EXT2_FT_SYMLINK:
		return DT_LNK;
	default:
		return DT_UNKNOWN;
	}
}



Home | Main Index | Thread Index | Old Index