Skip to content

Commit bbcba55

Browse files
cederomlupyuen
authored andcommitted
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 <[email protected]>
1 parent 1e4a952 commit bbcba55

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/xmlrpc/calls.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ struct xmlrpc_entry_s get_device_stats =
7070

7171
static int calls_get_device_stats(struct xmlrpc_s *xmlcall)
7272
{
73-
char username[80];
74-
char password[80];
75-
char lastCommand[80];
76-
char curState[80];
73+
char username[CONFIG_XMLRPC_STRINGSIZE + 1];
74+
char password[CONFIG_XMLRPC_STRINGSIZE + 1];
75+
char lastcmd[CONFIG_XMLRPC_STRINGSIZE + 1];
76+
char curstate[CONFIG_XMLRPC_STRINGSIZE + 1];
7777
int request = 0;
7878
int status;
7979
int ret;
@@ -105,13 +105,13 @@ static int calls_get_device_stats(struct xmlrpc_s *xmlcall)
105105
/* Dummy up some data... */
106106

107107
status = 1;
108-
strlcpy(lastCommand, "reboot", sizeof(lastCommand));
109-
strlcpy(curState, "Normal Operation", sizeof(curState));
108+
strlcpy(lastcmd, "reboot", sizeof(lastcmd));
109+
strlcpy(curstate, "Normal Operation", sizeof(curstate));
110110

111111
ret = xmlrpc_buildresponse(xmlcall, "{iss}",
112112
"status", status,
113-
"lastCommand", lastCommand,
114-
"currentState", curState);
113+
"lastCommand", lastcmd,
114+
"currentState", curstate);
115115
}
116116

117117
return ret;

0 commit comments

Comments
 (0)