strncmp issue

Channa channa.kad at gmail.com
Wed Apr 29 06:16:25 UTC 2009


2009/4/29 Olivier Houchard <mlfbsd at ci0.org>:
> On Tue, Apr 28, 2009 at 07:32:14PM +0530, Channa wrote:
>> Hi,
>>
>> Thank you very much for your response.
>> I am looking forward for your fix.
>>
>> Thanks & Regards,
>> Channa
>>
>
> Hi,
>
> I just committed a fix to -CURRENT, as rev 191633.
> It basically just checks if the length is 0, instead of len - 1 < 0.
>
> Thanks again,
>
> Olivier
>
>
>

Hi
Thank you very much. I used your fix and tested again.
When i tested as below :

TEST 1 :
  ret = strncmp("a", "L", -1);  <----------------- ret is '0'


TEST 2:
  ret = strncmp("1", "2", UINT_MAX); <------ ret is '-1'

But since size_t is unsigned int call to strncmp with third argument
as -1 should consider third argument  as UINT_MAX in TEST 1, but its
not happening so.

Could you please help me to know what could be the problem.

Thanks & Regards,
Channa


More information about the freebsd-arm mailing list