Todd C. Miller wrote: > On Wed, 17 Feb 2016 10:22:04 +0100, Martin Natano wrote: > > > Casting the result of ext2fs_size() and DIP(ip, size) to int potentially > > truncates the result. Issue found by Stefan Kempf, see > > https://marc.info/?l=openbsd-tech&m=145495905416536 . > > > > While there I also removed the cast in the ext2fs_chmod() call, because > > the function expects a mode_t argument anyway. > > There is currently code that checks for mnt_maxsymlinklen <= 0. > Removing the cast will cause other problems for ffs if the maxsymlinklen > value is negative. I don't think it is safe to make this change > unless mnt_maxsymlinklen is made unsigned in struct mount and a > check is added to the assignment of mnt_maxsymlinklen from > fs_maxsymlinklen in ufs/ffs/ffs_vfsops.c to avoid assigning a > negative value.
That makes sense. Those <= 0 checks look whether the FFS is in the "old" format. When creating an old format FFS, newfs creates a superblock with fs_maxsymlinklen of 0. A negative fs_maxsymlinklen should never happen except for bogus superblocks. So checking for this when mounting the filesystem looks reasonable. > - todd >