Re: [PATCH] allow file modes up to 7777 instead of 777
From:
Chet Ramey
Subject:
Re: [PATCH] allow file modes up to 7777 instead of 777
Date:
Fri, 16 Mar 2018 08:53:38 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
On 3/15/18 4:11 PM, Martijn Dekker wrote:
> Op 14-03-18 om 16:49 schreef Martijn Dekker:
> [...]
>> {
>> digits++;
>> result = (result * 8) + (*string++ - '0');
>> - if (result > 0777)
>> + if (result > 07777)
>> return -1;
>> }
>>
>> By the way, why does that function repeatedly check the bounds for every
>> digit?
>
> It just occurred to me that, given a huge number argument, this
> disallows the value to wrap around and return within the bounds.
The current code fails early.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/