From: Iain Sandoe Date: Mon, 10 Feb 2020 19:29:30 +0000 (+0100) Subject: Darwin: -Wformat-diag fix (PR93641) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c88ffcc6f4f46223c219014729f33f6cb9649928;p=gcc.git Darwin: -Wformat-diag fix (PR93641) The length used for the comparison for 'CFStringRef' was only comparing for 'CFString', potentially allowing mismatched identifiers. 2020-02-10 Iain Sandoe PR other/93641 * config/darwin-c.c (darwin_cfstring_ref_p): Fix up last argument of strncmp. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39de837b326..3892d9aed53 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-02-10 Iain Sandoe + + PR other/93641 + * config/darwin-c.c (darwin_cfstring_ref_p): Fix up last + argument of strncmp. + 2020-02-10 Hans-Peter Nilsson Try to generate zero-based comparisons. diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 6b2ba2f961c..85d775f056a 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -809,7 +809,8 @@ darwin_cfstring_ref_p (const_tree strp) tn = DECL_NAME (tn); return (tn && IDENTIFIER_POINTER (tn) - && !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef", 8)); + && !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef", + strlen ("CFStringRef"))); } /* At present the behavior of this is undefined and it does nothing. */