From 17b9a6add82781f71b4d84da7c804e0e72c8b026 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 1 Mar 2021 18:47:42 +0100 Subject: [PATCH] xmlrpc: use for null string values - XML-RPC extension listed at https://en.wikipedia.org/wiki/XML-RPC#Data_types --- src/modules/xmlrpc/xmlrpc.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/modules/xmlrpc/xmlrpc.c b/src/modules/xmlrpc/xmlrpc.c index dd64cf06f90..5e2a7466b09 100644 --- a/src/modules/xmlrpc/xmlrpc.c +++ b/src/modules/xmlrpc/xmlrpc.c @@ -264,6 +264,7 @@ static str member_prefix = STR_STATIC_INIT(""); static str member_suffix = STR_STATIC_INIT(""); static str name_prefix = STR_STATIC_INIT(""); static str name_suffix = STR_STATIC_INIT(""); +static str nil_value = STR_STATIC_INIT(""); /** Garbage collection data structure. * @@ -1066,17 +1067,29 @@ static int print_value(struct xmlrpc_reply* res, break; case 's': - prefix = string_prefix; - suffix = string_suffix; body.s = va_arg(*ap, char*); - body.len = strlen(body.s); + if(body.s!=NULL) { + prefix = string_prefix; + suffix = string_suffix; + body.len = strlen(body.s); + } else { + prefix = ""; + suffix = ""; + body = nil_value; + } break; case 'S': - prefix = string_prefix; - suffix = string_suffix; sp = va_arg(*ap, str*); - body = *sp; + if(sp!=NULL && sp->s!=NULL) { + prefix = string_prefix; + suffix = string_suffix; + body = *sp; + } else { + prefix = ""; + suffix = ""; + body = nil_value; + } break; default: