[Secure Coding] master: Correct advice on array allocatoin (#995595) (876a1bc)
fweimer at fedoraproject.org
fweimer at fedoraproject.org
Mon Aug 26 09:45:36 UTC 2013
Repository : http://git.fedorahosted.org/git/?p=secure-coding.git
On branch : master
>---------------------------------------------------------------
commit 876a1bcbd0b2687867aded985d142df5030988ae
Author: Florian Weimer <fweimer at redhat.com>
Date: Mon Aug 26 11:43:10 2013 +0200
Correct advice on array allocatoin (#995595)
>---------------------------------------------------------------
defensive-coding/en-US/C/Allocators.xml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/defensive-coding/en-US/C/Allocators.xml b/defensive-coding/en-US/C/Allocators.xml
index e86b37f..1bff610 100644
--- a/defensive-coding/en-US/C/Allocators.xml
+++ b/defensive-coding/en-US/C/Allocators.xml
@@ -135,8 +135,8 @@
is used, the size check must be written manually. For instance,
to allocate an array of <literal>n</literal> elements of type
<literal>T</literal>, check that the requested size is not
- greater than <literal>n / sizeof(T)</literal>. See <xref
- linkend="sect-Defensive_Coding-C-Arithmetic"/>.
+ greater than <literal>((size_t) -1) / sizeof(T)</literal>. See
+ <xref linkend="sect-Defensive_Coding-C-Arithmetic"/>.
</para>
</section>
More information about the security
mailing list