lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c00d9b0f-69d7-4243-bf3d-cfa5cb18e495@kadam.mountain>
Date:   Thu, 13 Jul 2023 17:26:59 +0300
From:   Dan Carpenter <dan.carpenter@...aro.org>
To:     David Laight <David.Laight@...lab.com>
Cc:     Linke Li <lilinke99@...mail.com>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jan Kara <jack@...e.cz>, Linke Li <lilinke99@...il.com>
Subject: Re: [PATCH] isofs: fix undefined behavior in iso_date()

On Thu, Jul 13, 2023 at 02:11:02PM +0000, David Laight wrote:
> From: Dan Carpenter
> > Sent: 10 July 2023 10:57
> > 
> > It looks like maybe there is an issue with "year" as well.
> > 
> > fs/isofs/util.c
> >     19  int iso_date(u8 *p, int flag)
> >     20  {
> >     21          int year, month, day, hour, minute, second, tz;
> >     22          int crtime;
> >     23
> >     24          year = p[0];
> >                        ^^^^^
> > year is 0-255.
> ....
> >     32
> >     33          if (year < 0) {
> >                     ^^^^^^^^
> > But this checks year for < 0 which is impossible.  Should it be:
> > 
> > 	year = (signed char)p[0];?
> 
> Or not?
> 
> What happens in 2027 ?
> I bet the value has to be treated an unsigned.

Yeah.  Good point.  We could delete that if statement and pull the whole
function in a tab.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ