From 8c715595eb3bd31a369466b76176aa3096d9b2ec Mon Sep 17 00:00:00 2001 From: Mohamed Kallel Date: Thu, 26 Sep 2013 09:43:07 +0100 Subject: [PATCH] SPV and SPA should return fault when param name is empty --- xml.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/xml.c b/xml.c index d9c83ed..eea7ea4 100644 --- a/xml.c +++ b/xml.c @@ -1112,6 +1112,12 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc parameter_value = NULL; } + if (b && b->type == MXML_ELEMENT && + !strcmp(b->value.element.name, "Name") && + !b->child) { + parameter_name = ""; + } + if (b && b->type == MXML_TEXT && b->value.text.string && b->parent->type == MXML_ELEMENT && @@ -1119,6 +1125,12 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc parameter_value = b->value.text.string; } + if (b && b->type == MXML_ELEMENT && + !strcmp(b->value.element.name, "Value") && + !b->child) { + parameter_value = ""; + } + if (parameter_name && parameter_value) { if (external_set_action("value", parameter_name, parameter_value, NULL)) goto fault; @@ -1226,18 +1238,33 @@ int cwmp_handle_rpc_cpe_set_parameter_attributes(struct session *session, struct !strcmp(b->parent->value.element.name, "Name")) { parameter_name = b->value.text.string; } + if (b && b->type == MXML_ELEMENT && + !strcmp(b->value.element.name, "Name") && + !b->child) { + parameter_name = ""; + } if (b && b->type == MXML_TEXT && b->value.text.string && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "NotificationChange")) { attr_notification_update = b->value.text.string; } + if (b && b->type == MXML_ELEMENT && + !strcmp(b->value.element.name, "NotificationChange") && + !b->child) { + attr_notification_update = ""; + } if (b && b->type == MXML_TEXT && b->value.text.string && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Notification")) { parameter_notification = b->value.text.string; } + if (b && b->type == MXML_ELEMENT && + !strcmp(b->value.element.name, "Notification") && + !b->child) { + parameter_notification = ""; + } if (attr_notification_update && parameter_name && parameter_notification) { if (external_set_action("notification", parameter_name, parameter_notification, attr_notification_update))