Re: Harmful casts in ufs

2016-02-22 Thread Todd C. Miller
On Mon, 22 Feb 2016 16:01:59 +0100, Martin Natano wrote: > On Mon, Feb 22, 2016 at 06:31:00AM -0700, Todd C. Miller wrote: > > > > I was concerned about old 4.2/4.3 filesystems having garbage in > > that location. It's not really an issue since we'll never really > > encounter such a file system

Re: Harmful casts in ufs

2016-02-22 Thread Martin Natano
On Mon, Feb 22, 2016 at 06:31:00AM -0700, Todd C. Miller wrote: > On Sun, 21 Feb 2016 16:33:27 +0100, Stefan Kempf wrote: > > > Should we really mount the FS in that case? If the FS was of the > > "new" format, then short symlinks would store the destination path in the > > inode directly. I think

Re: Harmful casts in ufs

2016-02-22 Thread Todd C. Miller
On Sun, 21 Feb 2016 16:33:27 +0100, Stefan Kempf wrote: > Should we really mount the FS in that case? If the FS was of the > "new" format, then short symlinks would store the destination path in the > inode directly. I think we'd not be able to correctly follow these symlinks > if we set fs_maxsym

Re: Harmful casts in ufs

2016-02-21 Thread Stefan Kempf
Todd C. Miller wrote: > On Sun, 21 Feb 2016 11:49:55 +0100, Martin Natano wrote: > > > The diff below addresses the issues you mentioned. It converts > > mnt_maxsymlinklen to unsigned and adds a check to ffs_validate() that > > makes sure, that fs_maxsymlinklen is >= 0. That function is called > >

Re: Harmful casts in ufs

2016-02-21 Thread Todd C. Miller
On Sun, 21 Feb 2016 11:49:55 +0100, Martin Natano wrote: > The diff below addresses the issues you mentioned. It converts > mnt_maxsymlinklen to unsigned and adds a check to ffs_validate() that > makes sure, that fs_maxsymlinklen is >= 0. That function is called > during mount and on fsck. This sh

Re: Harmful casts in ufs

2016-02-21 Thread Martin Natano
On Wed, Feb 17, 2016 at 11:27:29AM -0700, Todd C. Miller wrote: > 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

Re: Harmful casts in ufs

2016-02-18 Thread Stefan Kempf
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

Re: Harmful casts in ufs

2016-02-17 Thread Martin Natano
On Wed, Feb 17, 2016 at 11:27:29AM -0700, 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

Re: Harmful casts in ufs

2016-02-17 Thread Todd C. Miller
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 ext2f

Harmful casts in ufs

2016-02-17 Thread Martin Natano
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 anywa