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 <s@pahtak.org> wrote:
On Sep 17, 2015, at 5:23 PM, Stan Sieler <sieler@me.com> 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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com