Hi

As show in the PR, The length used for the comparison for 'CFStringRef’ was
only comparing for 'CFString', potentially allowing mismatched identifiers.

fixed thus,
tested on x86_64-darwin16,
applied to master
thanks
Iain

====

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  <i...@sandoe.co.uk>

           PR other/93641
           * config/darwin-c.c (darwin_cfstring_ref_p): Fix up last
           argument of strncmp.

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.  */

Reply via email to