Code review request: 8016594: Native Windows ccache still reads DES tickets
Dmitry Samersoff
dmitry.samersoff at oracle.com
Wed Aug 7 11:53:38 UTC 2013
Xuelei,
1. strncmp calls strlen at first, so explicit call to strlen is not
necessary.
2. strlen("krbtgt") == sizeof("krbtgt")-1
as sizeof count terminating 0.
-Dmitry
On 2013-08-07 15:31, Xuelei Fan wrote:
> On 8/7/2013 6:58 PM, Weijun Wang wrote:
>>
>>
>> On 8/7/13 5:23 PM, Dmitry Samersoff wrote:
>>> Weijun,
>>>
>>> nativeccache.c:
>>>
>>> 322: Could you change strlen("krbtgt") to sizeof("krbtgt")-1 to save a
>>> bit of computer power?
>>
>> Sure.
>
> strncmp() is normally work with strlen() while comparing two strings, in
> case the length of the two string are not equal.
>
> - 322 if (strncmp (serverName, "krbtgt", strlen("krbtgt")) == 0 &&
> + 322 if (strlen(serverName) == sizeof("krbtgt") &&
> + strncmp (serverName, "krbtgt", sizeof("krbtgt")) == 0 &&
>
> BTW, as it is a local function, would you like to add a "static" keyword
> to isIn() function?
>
> Xuelei
>
--
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the source code.
More information about the security-dev
mailing list