Visual RFC.
ALL RFCs / RFC 4506
Read the RFC ↗
RFC 4506 / External data representation

Decode with bounds and application checks

06

A valid representation is not authorization, a safe native string or a guarantee that all of its bytes have arrived.

RFC 4506 · § 8EXAMPLE
4 / 4
Decode with bounds and application checksTwo optional linked nodes are shown with a chosen budget2. Another presence marker stops processing before a third node. This is a resource policy, not a universal RFC node limit.Decode safely beyond representation rulesNode1: x=7Node2: x=8Next-present markers, not addressesChosen local node budget: 2Another present node would exceed itStop before node3XDR supplies neither transport framing nor authorization
04
Bound recursive optional structures

Two decoded nodes are shown; following another presence marker would exceed this local policy. The arrow stops at the resource gate rather than causing stack overflow.

Source for this drawing: RFC 4506 · Read RFC section 8 ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

First, agree how to read the message.

An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

Separate representation checks, incomplete input and application-specific limits.

  • Symbolic constants and typedefs declare names but encode no data by themselves. For example const MAX=8 and typedef unsigned int counter; do not add words before a counter value. The formal language is a data description, not executable code. The source’s §§4.17–4.18 and 6 define these rules.
  • The second state is a selected LOCAL buffer example for variable opaque data with count 5. Seven received bytes contain the four-byte count plus three payload bytes; the complete encoding needs twelve bytes including padding. Five more bytes are required before this helper returns a value. XDR defines the representation, not TCP delivery, message boundaries or an acknowledgment protocol (§§3,4.10).
  • The helper preserves incomplete input with zero consumption, checks its chosen bound before allocation and preserves a coalesced tail after a complete item. These are explicit implementation choices used to teach safe decoding. They do not implement every XDR type, a streaming transport or a general protocol parser (§8).
  • Counted bytes61 00 62 represent the three ASCII bytes a,NUL,b; a following zero is padding. The representation can be valid while a C-string API sees only a. Section8 warns about this memory-management hazard. The illustrated application gate rejects embedded NUL under its own string policy; XDR itself does not globally forbid that counted byte. Slash characters can likewise be legal ASCII yet illegal for a particular filename component.
  • Section8 advises non-recursive processing or limits on recursive structures to avoid denial of service. A chosen limit of two nodes stops a third node; two is an example, not an RFC-mandated constant. Resource limits remain necessary even with legal optional-data encodings. Protocols carrying XDR must provide any required security services; XDR does not supply encryption, identity or permission checks.
DETAILS

Illustrative values and bounded offline encoding/decoding models. Not a complete XDR compiler, RPC/NFS implementation, transport, memory allocator or security verifier.

Read the RFC section ↗

All chapters in RFC 4506

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗