File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1
1
edges
2
2
| main.cpp:6:27:6:30 | argv indirection | main.cpp:10:20:10:23 | argv indirection |
3
- | main.cpp:10:20:10:23 | argv indirection | tests.cpp:618 :32:618 :35 | argv indirection |
3
+ | main.cpp:10:20:10:23 | argv indirection | tests.cpp:631 :32:631 :35 | argv indirection |
4
4
| tests.cpp:613:19:613:24 | source indirection | tests.cpp:615:17:615:22 | source indirection |
5
- | tests.cpp:618 :32:618 :35 | argv indirection | tests.cpp:643 :9:643 :15 | access to array indirection |
6
- | tests.cpp:643 :9:643 :15 | access to array indirection | tests.cpp:613:19:613:24 | source indirection |
5
+ | tests.cpp:631 :32:631 :35 | argv indirection | tests.cpp:656 :9:656 :15 | access to array indirection |
6
+ | tests.cpp:656 :9:656 :15 | access to array indirection | tests.cpp:613:19:613:24 | source indirection |
7
7
nodes
8
8
| main.cpp:6:27:6:30 | argv indirection | semmle.label | argv indirection |
9
9
| main.cpp:10:20:10:23 | argv indirection | semmle.label | argv indirection |
10
10
| tests.cpp:613:19:613:24 | source indirection | semmle.label | source indirection |
11
11
| tests.cpp:615:17:615:22 | source indirection | semmle.label | source indirection |
12
- | tests.cpp:618 :32:618 :35 | argv indirection | semmle.label | argv indirection |
13
- | tests.cpp:643 :9:643 :15 | access to array indirection | semmle.label | access to array indirection |
12
+ | tests.cpp:631 :32:631 :35 | argv indirection | semmle.label | argv indirection |
13
+ | tests.cpp:656 :9:656 :15 | access to array indirection | semmle.label | access to array indirection |
14
14
subpaths
15
15
#select
16
16
| tests.cpp:615:2:615:7 | call to strcpy | main.cpp:6:27:6:30 | argv indirection | tests.cpp:615:17:615:22 | source indirection | This 'call to strcpy' with input from $@ may overflow the destination. | main.cpp:6:27:6:30 | argv indirection | a command-line argument |
Original file line number Diff line number Diff line change @@ -615,6 +615,19 @@ void test24(char* source) {
615
615
strcpy (buffer, source); // BAD
616
616
}
617
617
618
+ struct my_struct {
619
+ char * home;
620
+ };
621
+
622
+ void test25 (char * source) {
623
+ my_struct s;
624
+
625
+ s.home = source;
626
+
627
+ char buf[100 ];
628
+ strcpy (buf, s.home ); // BAD [NOT DETECTED]
629
+ }
630
+
618
631
int tests_main (int argc, char *argv[])
619
632
{
620
633
long long arr17[19 ];
@@ -641,6 +654,7 @@ int tests_main(int argc, char *argv[])
641
654
test22 (argc == 0 , argv[0 ]);
642
655
test23 ();
643
656
test24 (argv[0 ]);
657
+ test25 (argv[0 ]);
644
658
645
659
return 0 ;
646
660
}
You can’t perform that action at this time.
0 commit comments