Skip to content

Commit e4cf7df

Browse files
committed
C++: Edits to the .qhelp based on suggestions.
1 parent b8b3689 commit e4cf7df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cpp/ql/src/Security/CWE/CWE-416/UseOfStringAfterLifetimeEnds.qhelp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ longer valid. If the pointer is used after the <code>std::string</code> object i
1010
</p>
1111

1212
<p>Typically this problem occurs when a <code>std::string</code> is returned by a function call (or overloaded operator)
13-
by value, and the result is not immediately stored in a variable by value (or <code>const</code> reference). The resulting
14-
temporary <code>std::string</code> object is destroyed at the end of the expression statement it is contained in, along
15-
with any memory returned by a call to <code>c_str</code>.
13+
by value, and the result is not immediately stored in a variable by value or reference in a way that extends the lifetime of
14+
the temporary object. The resulting temporary <code>std::string</code> object is destroyed at the end of the expression
15+
statement it is contained in, along with any memory returned by a call to <code>c_str</code>.
1616
</p>
1717
</overview>
1818

@@ -46,6 +46,7 @@ points to valid memory.
4646

4747
<li><a href="https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM50-CPP.+Do+not+access+freed+memory">MEM50-CPP. Do not access freed memory</a>.</li>
4848
<li>Microsoft Learn: <a href="https://learn.microsoft.com/en-us/cpp/cpp/temporary-objects?view=msvc-170">Temporary objects</a>.</li>
49+
<li>cppreference.com: <a href="https://en.cppreference.com/w/cpp/language/reference_initialization#Lifetime_of_a_temporary">Lifetime of a temporary</a>.</li>
4950

5051
</references>
5152
</qhelp>

0 commit comments

Comments
 (0)