Re: kdp_match_name
Re: kdp_match_name
- Subject: Re: kdp_match_name
- From: Stan Sieler <email@hidden>
- Date: Thu, 17 Sep 2015 22:58:41 -0700
And that would make sense…if both arguments were potentially unbounded.
But when one’s a constant string, you *know* it has a null at a decent spot!
> On Sep 17, 2015, at 8:48 PM, Stephen Checkoway <email@hidden> wrote:
>
>
>> On Sep 17, 2015, at 5:23 PM, Stan Sieler <email@hidden> wrote:
>>
>> I’m asking partially to learn if my understanding of when to use
>> strncmp is wrong or not.
>
> strncmp and strncpy are for working with fixed-width fields which may not be NUL-terminated. It's extremely rare that these functions should be used.
>
> The code in question appears to have
>
> char kdpname[80];
>
> so using strncmp doesn't really matter here. My guess is that it was done because some code paths in PE_parse_boot_argn (those for arguments that aren't strings) don't NUL-terminate.
>
>
> --
> Stephen Checkoway
>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden