This is an automated email from the ASF dual-hosted git repository.

lupyuen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new bbcba55bb examples/xmlrpc: Fix calls buffers size.
bbcba55bb is described below

commit bbcba55bbc357b3c5f651379f55b2917075e4df9
Author: Tomasz 'CeDeROM' CEDRO <to...@cedro.info>
AuthorDate: Mon Mar 17 04:58:48 2025 +0100

    examples/xmlrpc: Fix calls buffers size.
    
    * 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 <to...@cedro.info>
---
 examples/xmlrpc/calls.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/xmlrpc/calls.c b/examples/xmlrpc/calls.c
index 41ac1a5fe..c2d817a5c 100644
--- a/examples/xmlrpc/calls.c
+++ b/examples/xmlrpc/calls.c
@@ -70,10 +70,10 @@ struct xmlrpc_entry_s get_device_stats =
 
 static int calls_get_device_stats(struct xmlrpc_s *xmlcall)
 {
-  char username[80];
-  char password[80];
-  char lastCommand[80];
-  char curState[80];
+  char username[CONFIG_XMLRPC_STRINGSIZE + 1];
+  char password[CONFIG_XMLRPC_STRINGSIZE + 1];
+  char lastcmd[CONFIG_XMLRPC_STRINGSIZE + 1];
+  char curstate[CONFIG_XMLRPC_STRINGSIZE + 1];
   int request = 0;
   int status;
   int ret;
@@ -105,13 +105,13 @@ static int calls_get_device_stats(struct xmlrpc_s 
*xmlcall)
       /* Dummy up some data... */
 
       status = 1;
-      strlcpy(lastCommand, "reboot", sizeof(lastCommand));
-      strlcpy(curState, "Normal Operation", sizeof(curState));
+      strlcpy(lastcmd, "reboot", sizeof(lastcmd));
+      strlcpy(curstate, "Normal Operation", sizeof(curstate));
 
       ret = xmlrpc_buildresponse(xmlcall, "{iss}",
                                  "status", status,
-                                 "lastCommand", lastCommand,
-                                 "currentState", curState);
+                                 "lastCommand", lastcmd,
+                                 "currentState", curstate);
     }
 
   return ret;

Reply via email to