Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -651,8 +651,8 @@ const auto *Target = CE->getArg(0)->IgnoreImpCasts(), *Source = CE->getArg(1)->IgnoreImpCasts(); - if (const auto *DeclRef = dyn_cast(Target)) - if (const auto *Array = dyn_cast(DeclRef->getType())) { + if (isa(Target) || isa(Target)) + if (const auto *Array = dyn_cast(Target->getType())) { uint64_t ArraySize = BR.getContext().getTypeSize(Array) / 8; if (const auto *String = dyn_cast(Source)) { if (ArraySize >= String->getLength() + 1) Index: test/Analysis/security-syntax-checks.m =================================================================== --- test/Analysis/security-syntax-checks.m +++ test/Analysis/security-syntax-checks.m @@ -177,6 +177,11 @@ strcpy(x, "abcd"); } +void test_strcpy_safe_2() { + struct {char s1[100];} s; + strcpy(s.s1, "hello"); +} + //===----------------------------------------------------------------------=== // strcat() //===----------------------------------------------------------------------===