Skip to content

examples/xmlrpc: Fix calls buffers size. - #3027

Merged
lupyuen merged 1 commit into
apache:masterfrom
cederom:20250316-cederom-examples_xmlrpc_fix
Mar 21, 2025
Merged

examples/xmlrpc: Fix calls buffers size.#3027
lupyuen merged 1 commit into
apache:masterfrom
cederom:20250316-cederom-examples_xmlrpc_fix

Conversation

@cederom

@cederom cederom commented Mar 17, 2025

Copy link
Copy Markdown
Contributor

Summary

  • examples/xmlrpc/calls.c used 80 bytes call buffers.
  • update buffers to CONFIG_XMLRPC_STRINGSIZE+1 that is build time configurable.
  • this keeps buffers size coherent with configuration.
  • updated internal variable names to pass lint checks.

Impact

  • xmlrpc strings and buffers are now equal in size that prevents overflows.

Testing

Please help in runtime testing :-)

% uname -a
FreeBSD octagon 14.2-RELEASE-p1 FreeBSD 14.2-RELEASE-p1 GENERIC amd64

% ./tools/configure.sh -B esp32-devkitc:wifinsh

% gmake menuconfig <- enable apps / examples / xmlrpc.

% kconfig-diff
 BASE_DEFCONFIG "esp32-devkitc:wifinsh" -> "esp32-devkitc:wifinsh-dirty"
 EXAMPLES_XMLRPC n -> y
 NETUTILS_XMLRPC n -> y
+EXAMPLES_XMLRPC_BUFFERSIZE 1024
+XMLRPC_STRINGSIZE 64

% gmake -j8
Create version.h
Cloning Espressif HAL for 3rd Party Platforms
Clone: chip/esp-hal-3rdparty
Downloading: v1.7.12.tar.gz
Unpacking: v1.7.12.tar.gz -> cJSON
Register: xmlrpc
Register: renew
Register: nsh
Register: ping
Register: sh
Register: telnetd
Register: wapi
Espressif HAL for 3rd Party Platforms: e5cef265cca9d272c428d210453d574bcc25c5f4
Espressif HAL for 3rd Party Platforms: initializing submodules...
Applying patches...
CPP:  /XXX/nuttx.git/arch/xtensa/src/chip/esp-hal-3rdparty/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld-> /XXX/nuttx.git/arch/xtensa/src/chip/esp-hal-3rdparty/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld.tmpLD: nuttx
Memory region         Used Size  Region Size  %age Used
             ROM:      776692 B    4194272 B     18.52%
     iram0_0_seg:      128812 B       168 KB     74.88%
     irom0_0_seg:      580084 B    3342304 B     17.36%
     dram0_0_seg:       73064 B     180736 B     40.43%
     drom0_0_seg:      139276 B    4194272 B      3.32%
    rtc_iram_seg:          0 GB         8 KB      0.00%
    rtc_slow_seg:          0 GB         4 KB      0.00%
      extmem_seg:          0 GB         4 MB      0.00%
CP: nuttx.hex
MKIMAGE: ESP32 binary
esptool.py -c esp32 elf2image --ram-only-header -fs 4MB -fm dio -ff 40m -o nuttx.bin nuttx
esptool.py v4.8.1
Creating esp32 image...
Image has only RAM segments visible. ROM segments are hidden and SHA256 digest is not appended.
Merged 1 ELF section
Successfully created esp32 image.
Generated: nuttx.bin

@cederom

cederom commented Mar 17, 2025

Copy link
Copy Markdown
Contributor Author

Formatting issues, sorry, will fix after a short sleep mode (6AM here) :-)

@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.

@acassis: Please fix coding style issues

Done :-)

Mixed case identifiers were here before and seem to be part of XMLRPC implementation? See https://xmlrpc-c.sourceforge.io/doc/libxmlrpc_client++.html. These are internal variables so we can change them with no impact I guess :-)

@cederom
cederom force-pushed the 20250316-cederom-examples_xmlrpc_fix branch from 9b15b51 to 439a654 Compare March 18, 2025 12:03
@acassis

acassis commented Mar 18, 2025

Copy link
Copy Markdown
Contributor

@cederom suggestion: lastCommand -> lastcmd; curState -> curstate

* examples/xmlrpc/calls.c used 80 bytes call buffers.
* update buffers to CONFIG_XMLRPC_STRINGSIZE+1 that is build time configurable.
* this keeps buffers size coherent with configuration.
* updated internal variable names to pass lint checks.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
@cederom
cederom force-pushed the 20250316-cederom-examples_xmlrpc_fix branch from 439a654 to 3b03e73 Compare March 20, 2025 20:49
@github-actions github-actions Bot added Size: S and removed Size: XS labels Mar 20, 2025
@cederom

cederom commented Mar 20, 2025

Copy link
Copy Markdown
Contributor Author

Variables updated: lastCommand -> lastcmd; curState -> curstate :-)

% gmake -j8
Create version.h
Downloading: v1.7.12.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Cloning Espressif HAL for 3rd Party Platforms
Clone: chip/esp-hal-3rdparty LN: platform/board to /XXX/nuttx-apps.git/platform/dummy
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  340k  100  340k    0     0   473k      0 --:--:-- --:--:-- --:--:--  473k
Unpacking: v1.7.12.tar.gz -> cJSON
Register: xmlrpc
Register: renew
Register: ping
Register: nsh
Register: sh
Register: telnetd
Register: wapi
Espressif HAL for 3rd Party Platforms: e5cef265cca9d272c428d210453d574bcc25c5f4
Espressif HAL for 3rd Party Platforms: initializing submodules...
Applying patches...
(..)
Memory region         Used Size  Region Size  %age Used
             ROM:      776692 B    4194272 B     18.52%
     iram0_0_seg:      128812 B       168 KB     74.88%
     irom0_0_seg:      580084 B    3342304 B     17.36%
     dram0_0_seg:       73064 B     180736 B     40.43%
     drom0_0_seg:      139276 B    4194272 B      3.32%
    rtc_iram_seg:          0 GB         8 KB      0.00%
    rtc_slow_seg:          0 GB         4 KB      0.00%
      extmem_seg:          0 GB         4 MB      0.00%
CP: nuttx.hex
MKIMAGE: ESP32 binary
esptool.py -c esp32 elf2image --ram-only-header -fs 4MB -fm dio -ff 40m -o nuttx.bin nuttx
esptool.py v4.8.1
Creating esp32 image...
Image has only RAM segments visible. ROM segments are hidden and SHA256 digest is not appended.
Merged 1 ELF section
Successfully created esp32 image.
Generated: nuttx.bin

@lupyuen
lupyuen merged commit bbcba55 into apache:master Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants