From: David Carlier Date: Wed, 15 Aug 2018 20:09:52 +0000 (+0000) Subject: [CStringSyntaxChecker] Reduces space around error message for strlcat. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d032410f8ef9a4e1d3086ddd8211c4555bfef8f5;p=clang [CStringSyntaxChecker] Reduces space around error message for strlcat. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339808 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp b/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp index 2763408fac..cef48c551d 100644 --- a/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp @@ -273,7 +273,7 @@ void WalkAST::VisitCallExpr(CallExpr *CE) { if (!LenName.empty()) os << "'" << LenName << "'"; else - os << " "; + os << ""; if (!DstName.empty()) os << " - strlen(" << DstName << ")"; else diff --git a/test/Analysis/cstring-syntax.c b/test/Analysis/cstring-syntax.c index c6d3694060..26e3616017 100644 --- a/test/Analysis/cstring-syntax.c +++ b/test/Analysis/cstring-syntax.c @@ -42,7 +42,7 @@ void testStrlcat(const char *src) { strlcpy(dest, "aaaaa", sizeof("aaaaa") - 1); strlcat(dest, "bbbb", (sizeof("bbbb") - 1) - sizeof(dest) - 1); strlcpy(dest, "012345678", sizeof(dest)); - strlcat(dest, "910", sizeof(dest)); // expected-warning {{The third argument allows to potentially copy more bytes than it should. Replace with the value - strlen(dest) - 1 or lower}} + strlcat(dest, "910", sizeof(dest)); // expected-warning {{The third argument allows to potentially copy more bytes than it should. Replace with the value - strlen(dest) - 1 or lower}} strlcpy(dest, "0123456789", sizeof(dest)); strlcat(dest, "0123456789", badlen); // expected-warning {{The third argument allows to potentially copy more bytes than it should. Replace with the value 'badlen' - strlen(dest) - 1 or lower}} strlcat(dest, "0123456789", badlen - strlen(dest) - 1);