Skip to content

Commit a6f20a6

Browse files
geoffw0mchammer01
andauthored
Apply suggestions from code review
Co-authored-by: mc <[email protected]>
1 parent 28c0e89 commit a6f20a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rust/ql/src/queries/security/CWE-696/BadCtorInitialization.qhelp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<overview>
66

77
<p>
8-
Calling functions and methods in the Rust <code>std</code> library from a <code>#[ctor]</code> or <code>#[dtor]</code> function is not safe. This is because the <code>std</code> library only guarantees stability and portability between the beginning and end of <code>main</code>, whereas <code>#[ctor]</code> functions are called before <code>main</code>, and <code>#[dtor]</code> functions are called after it.
8+
Calling functions and methods in the Rust <code>std</code> library from a <code>#[ctor]</code> or <code>#[dtor]</code> function is not safe. This is because the <code>std</code> library only guarantees stability and portability between the beginning and the end of <code>main</code>, whereas <code>#[ctor]</code> functions are called before <code>main</code>, and <code>#[dtor]</code> functions are called after it.
99
</p>
1010

1111
</overview>
@@ -23,13 +23,13 @@ Do not call any part of the <code>std</code> library from a <code>#[ctor]</code>
2323
<example>
2424

2525
<p>
26-
In the following example, a <code>#[ctor]</code> function uses the <code>println!</code> macro which calls <code>std</code> library functions. This may cause unexpected behaviour at runtime.
26+
In the following example, a <code>#[ctor]</code> function uses the <code>println!</code> macro which calls <code>std</code> library functions. This may cause unexpected behavior at runtime.
2727
</p>
2828

2929
<sample src="BadCtorInitializationBad.rs" />
3030

3131
<p>
32-
The issue can be fixed by replacing <code>println!</code> with something that does not rely on the <code>std</code> library. In the fixed code below we use the <code>libc_println!</code> macro from the <code>libc-print</code> library:
32+
The issue can be fixed by replacing <code>println!</code> with something that does not rely on the <code>std</code> library. In the fixed code below, we used the <code>libc_println!</code> macro from the <code>libc-print</code> library:
3333
</p>
3434

3535
<sample src="BadCtorInitializationGood.rs" />

0 commit comments

Comments
 (0)