Skip to content

Commit bff23f5

Browse files
committed
CPP: Clearer naming.
1 parent ca99947 commit bff23f5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-468/semmle/SuspiciousAddWithSizeof/SuspiciousAddWithSizeof.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
| test.cpp:30:25:30:35 | sizeof(int) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is int *. |
55
| test.cpp:38:30:38:40 | sizeof(int) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is int *. |
66
| test.cpp:61:27:61:37 | sizeof(int) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is int *. |
7-
| test.cpp:89:40:89:52 | sizeof(MyABC) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is myInt *const. |
7+
| test.cpp:89:43:89:55 | sizeof(MyABC) | Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is myInt *const. |

cpp/ql/test/query-tests/Security/CWE/CWE-468/semmle/SuspiciousAddWithSizeof/test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ class MyTest8Class
8282
{
8383
public:
8484
MyTest8Class() :
85-
pairPtr((myChar *)malloc(sizeof(MyABC) * 2)),
86-
pairPtrInt((myInt *)malloc(sizeof(MyABC) * 2))
85+
myCharsPointer((myChar *)malloc(sizeof(MyABC) * 2)),
86+
myIntsPointer((myInt *)malloc(sizeof(MyABC) * 2))
8787
{
88-
myChar *secondPtr = pairPtr + sizeof(MyABC); // GOOD
89-
myInt *secondPtrInt = pairPtrInt + sizeof(MyABC); // BAD
88+
myChar *secondPtr = myCharsPointer + sizeof(MyABC); // GOOD
89+
myInt *secondPtrInt = myIntsPointer + sizeof(MyABC); // BAD
9090
}
9191

9292
private:
93-
myChar * const pairPtr;
94-
myInt * const pairPtrInt;
93+
myChar * const myCharsPointer;
94+
myInt * const myIntsPointer;
9595
};

0 commit comments

Comments
 (0)