@@ -42,9 +42,7 @@ predicate spaceProblem(FunctionCall append, string msg) {
4242}
4343
4444predicate wideCharSizeofProblem ( FunctionCall call , string msg ) {
45- exists (
46- Variable buffer , SizeofExprOperator sizeofOp
47- |
45+ exists ( Variable buffer , SizeofExprOperator sizeofOp |
4846 // Function call is to wcsftime
4947 call .getTarget ( ) .hasGlobalOrStdName ( "wcsftime" ) and
5048 // Second argument (count parameter) is a sizeof operation
@@ -57,17 +55,19 @@ predicate wideCharSizeofProblem(FunctionCall call, string msg) {
5755 arrayType = buffer .getType ( ) and
5856 arrayType .getBaseType ( ) .hasName ( "wchar_t" ) and
5957 msg =
60- "Using sizeof(" + buffer .getName ( ) + ") passes byte count instead of wchar_t element count to wcsftime. " +
61- "Use sizeof(" + buffer .getName ( ) + ")/sizeof(wchar_t) or array length instead."
58+ "Using sizeof(" + buffer .getName ( ) +
59+ ") passes byte count instead of wchar_t element count to wcsftime. " + "Use sizeof(" +
60+ buffer .getName ( ) + ")/sizeof(wchar_t) or array length instead."
6261 )
6362 or
6463 // Case 2: Pointer to wchar_t - sizeof gives pointer size, which is completely wrong
6564 exists ( PointerType ptrType |
6665 ptrType = buffer .getType ( ) and
6766 ptrType .getBaseType ( ) .hasName ( "wchar_t" ) and
6867 msg =
69- "Using sizeof(" + buffer .getName ( ) + ") passes pointer size instead of buffer size to wcsftime. " +
70- "Pass the actual element count or use a length variable instead."
68+ "Using sizeof(" + buffer .getName ( ) +
69+ ") passes pointer size instead of buffer size to wcsftime. " +
70+ "Pass the actual element count or use a length variable instead."
7171 )
7272 )
7373 )
0 commit comments