Code review request: 8016594: Native Windows ccache still reads DES tickets

Xuelei Fan xuelei.fan at oracle.com
Wed Aug 7 04:31:39 PDT 2013


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


More information about the security-dev mailing list