Skip to content

netutils/xmlrpc: Bound parsed XML-RPC parameters - #3899

Open
anchao wants to merge 2 commits into
apache:masterfrom
anchao:26102203
Open

anchao wants to merge 2 commits into
apache:masterfrom
anchao:26102203

Conversation

@anchao

@anchao anchao commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Add bounds checking for parsed XML-RPC request parameters in the netutils XML-RPC parser.

Problem

xmlrpc_parseparam() used g_xmlcall.argsize to index the fixed-size XML-RPC parameter arrays without checking it against MAX_ARGS.

The affected arrays are:

  • g_xmlcall.args[]
  • g_xmlcall.arguments[]

A request containing more parameters than MAX_ARGS could write past these arrays.

Additionally, parse errors from parameter parsing were not propagated consistently, and xmlrpc_parse() did not honor failures returned by xmlrpc_parsemethod() before attempting to continue parsing and dispatch the request.

Solution

This change:

  • rejects additional parameters once g_xmlcall.argsize reaches MAX_ARGS
  • propagates xmlrpc_parseparam() failures from xmlrpc_parseparams()
  • makes xmlrpc_parse() honor xmlrpc_parsemethod() failures
  • prevents dispatching the registered XML-RPC method after a parse failure

Testing

sim/nsh and enable CONFIG_NETUTILS_XMLRPC

xmlrpc_parseparam() used g_xmlcall.argsize to index the fixed-size
XML-RPC parameter arrays without checking it against MAX_ARGS.  A
request with too many parameters could write past g_xmlcall.args[] and
g_xmlcall.arguments[].

Reject additional parameters once MAX_ARGS is reached, propagate parse
errors while parsing the parameter list, and make xmlrpc_parse() honor
xmlrpc_parsemethod() failures before dispatching the registered method.

Signed-off-by: chao an <anchao.archer@bytedance.com>

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anchao please fix the bad alignment, I think it is failing because it was enforced recently on nxstyle, this explains why the original code already had this issue

Fix nxstyle "Bad alignment" errors in the switch-case block of
xmlrpc_parseparam().  Align case labels and body statements to
conform with the NuttX coding standard.

Signed-off-by: chao an <anchao.archer@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants