[RTEMS Project] #4427: GcovData.cc: Dereference after null check error spotted by Coverity
RTEMS trac
trac at rtems.org
Tue May 18 16:19:41 UTC 2021
#4427: GcovData.cc: Dereference after null check error spotted by Coverity
------------------------+----------------------
Reporter: Ryan Long | Owner: (none)
Type: defect | Status: new
Priority: normal | Milestone: 6.1
Component: tool | Version: 6
Severity: normal | Keywords: Coverity
Blocked By: | Blocking:
------------------------+----------------------
CID 1399597: Dereference after null check in readGcnoFile().
{{{
53 strcpy( gcnoFileName, fileName );
54 strcpy( gcdaFileName, fileName );
55 strcpy( textFileName, fileName );
56 strcpy( cFileName, fileName );
57 tempString = strstr( gcdaFileName,".gcno" );
58 tempString2 = strstr( textFileName,".gcno" );
59 tempString3 = strstr( cFileName,".gcno" );
60
2. Condition tempString == NULL, taking true branch.
3. var_compare_op: Comparing tempString to null implies that tempString
might be null.
4. Condition tempString2 == NULL, taking false branch.
61 if ( (tempString == NULL) && (tempString2 == NULL) ){
62 fprintf(stderr, "ERROR: incorrect name of *.gcno file\n");
63 }
64 else
65 {
CID 1399597 (#1 of 1): Dereference after null check (FORWARD_NULL)5.
var_deref_model: Passing null pointer tempString to strcpy, which
dereferences it.
66 strcpy( tempString, ".gcda"); // construct gcda file
name
67 strcpy( tempString2, ".txt"); // construct report
file name
68 strcpy( tempString3, ".c"); // construct source
file name
69 }
}}}
--
Ticket URL: <http://devel.rtems.org/ticket/4427>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list