Additional markup fixes
This commit is contained in:
parent
454105c4d7
commit
9e89b54cf2
10 changed files with 30 additions and 27 deletions
|
@ -1,4 +1,6 @@
|
|||
|
||||
:experimental:
|
||||
|
||||
A Guide to Improving Software Security
|
||||
|
||||
[abstract]
|
||||
|
|
|
@ -60,8 +60,7 @@ terminate the process. See
|
|||
for related memory allocation concerns.
|
||||
|
||||
[[sect-Defensive_Coding-C-Allocators-alloca]]
|
||||
===== `alloca` and Other Forms of Stack-based
|
||||
Allocation
|
||||
===== `alloca` and Other Forms of Stack-based Allocation
|
||||
|
||||
Allocation on the stack is risky because stack overflow checking
|
||||
is implicit. There is a guard page at the end of the memory
|
||||
|
|
|
@ -188,6 +188,7 @@ after the `*`, and not before it.
|
|||
.Declaring a constant array of constant strings
|
||||
====
|
||||
|
||||
[source,c]
|
||||
----
|
||||
include::snippets/C-Globals-String_Array.adoc[]
|
||||
|
||||
|
@ -210,7 +211,7 @@ stack space usage on embedded platforms, where the stack may
|
|||
span only a few hundred bytes. If this is the only reason why
|
||||
the `static` keyword is used, it can just be
|
||||
dropped, unless the object is very large (larger than
|
||||
128 kilobytes on 32 bit platforms). In the latter case, it is
|
||||
128 kilobytes on 32-bit platforms). In the latter case, it is
|
||||
recommended to allocate the object using
|
||||
`malloc`, to obtain proper array checking, for
|
||||
the same reasons outlined in <<sect-Defensive_Coding-C-Allocators-alloca>>.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
:experimental:
|
||||
|
||||
include::entities.adoc[]
|
||||
|
||||
[[sect-Defensive_Coding-C-Libc]]
|
||||
|
|
|
@ -75,7 +75,7 @@ safety provides a benefit to the programmer.
|
|||
it can be patched in a central place if necessary.
|
||||
|
||||
The KDE project publishes a document with more extensive
|
||||
guidelines on ABI-preserving changes to C++ code, link:++http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++++[Policies/Binary
|
||||
guidelines on ABI-preserving changes to C++ code, link:++https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B++[Policies/Binary
|
||||
Compatibility Issues With C++]
|
||||
(*d-pointer* refers to the
|
||||
pointer-to-implementation idiom).
|
||||
|
|
|
@ -29,7 +29,7 @@ data, implementing an exponential growth policy. See the
|
|||
.Incrementally reading a byte array
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,java]
|
||||
----
|
||||
include::snippets/Java-Language-ReadArray.adoc[]
|
||||
|
||||
|
@ -60,7 +60,7 @@ possible and should not throw any exceptions.
|
|||
.Resource management with a `try`-`finally` block
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,java]
|
||||
----
|
||||
include::snippets/Java-Finally.adoc[]
|
||||
|
||||
|
@ -85,7 +85,7 @@ used instead. The Java compiler will automatically insert the
|
|||
.Resource management using the `try`-with-resource construct
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,java]
|
||||
----
|
||||
include::snippets/Java-TryWithResource.adoc[]
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ beginning of the array.
|
|||
.Array length checking in JNI code
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,java]
|
||||
----
|
||||
include::snippets/Java-JNI-Pointers.adoc[]
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ as possible. (This will not work reliable with really short
|
|||
fragment IDs, such as the 16 bit IDs used by the Internet
|
||||
Protocol.)
|
||||
|
||||
==== Library
|
||||
Support for Deserialization
|
||||
[[sect-Defensive_Coding-Tasks-Serialization-Library]]
|
||||
==== Library Support for Deserialization
|
||||
|
||||
For some languages, generic libraries are available which allow
|
||||
to serialize and deserialize user-defined objects. The
|
||||
|
@ -194,7 +194,7 @@ in various places.
|
|||
|
||||
* In the DTD declaration in the header of an XML document:
|
||||
+
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
|
||||
<!DOCTYPE html PUBLIC
|
||||
|
@ -205,7 +205,7 @@ in various places.
|
|||
|
||||
* In a namespace declaration:
|
||||
+
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
|
@ -214,7 +214,7 @@ in various places.
|
|||
|
||||
* In an entity defintion:
|
||||
+
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
|
||||
<!ENTITY sys SYSTEM "http://www.example.com/ent.adoc[]>
|
||||
|
@ -225,7 +225,7 @@ in various places.
|
|||
|
||||
* In a notation:
|
||||
+
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
|
||||
<!NOTATION not SYSTEM "../not.adoc[]>
|
||||
|
@ -306,7 +306,7 @@ problems related to that.
|
|||
.Disabling XML entity processing with Expat
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
include::snippets/Tasks-Serialization-XML-Expat-EntityDeclHandler.adoc[]
|
||||
|
||||
|
@ -321,7 +321,7 @@ This handler must be installed when the
|
|||
.Creating an Expat XML parser
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
include::snippets/Tasks-Serialization-XML-Expat-Create.adoc[]
|
||||
|
||||
|
@ -354,7 +354,7 @@ parsing to stop when encountering entity declarations.
|
|||
.A QtXml entity handler which blocks entity processing
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
include::snippets/Tasks-Serialization-XML-Qt-NoEntityHandler.adoc[]
|
||||
|
||||
|
@ -375,7 +375,7 @@ may need adjusting.
|
|||
.A QtXml XML reader which blocks entity processing
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
include::snippets/Tasks-Serialization-XML-Qt-NoEntityReader.adoc[]
|
||||
|
||||
|
@ -397,7 +397,7 @@ return value and report any error.
|
|||
.Parsing an XML document with QDomDocument, without entity expansion
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,xml]
|
||||
----
|
||||
include::snippets/Tasks-Serialization-XML-Qt-QDomDocument.adoc[]
|
||||
|
||||
|
@ -428,7 +428,7 @@ external ID resolution.
|
|||
.Helper class to prevent DTD external entity resolution in OpenJDK
|
||||
====
|
||||
|
||||
[subs="quotes"]
|
||||
[source,java]
|
||||
----
|
||||
include::snippets/Tasks-Serialization-XML-OpenJDK-NoEntityResolver.adoc[]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
:HOLDER: Red Hat, Inc
|
||||
|
||||
:YEAR: 2012-2017
|
||||
:YEAR: 2012-2018
|
||||
|
||||
:nbsp:
|
|
@ -2,7 +2,7 @@
|
|||
:toc: left
|
||||
:toclevels: 3
|
||||
:source-highlighter: pygments
|
||||
:pygments-style: manni
|
||||
:pygments-style: friendly
|
||||
:pygments-linenums-mode: inline
|
||||
|
||||
= Defensive Coding Guide
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue