client: prohibit endpoint ids without @ character
The function mgcp_msg_gen() does only check if the user supplied
an endpoint name or not. The user may still supply an endpoint
name that does not contain the separator (@) character.
- Refuse to generate the message if the endpoint name does not
contain any @ character.
Change-Id: I92dd1556e4a26b4bef8e1c8c57141552abf988ca
diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index 593d305..efe1d1f 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -862,6 +862,14 @@
msgb_free(msg);
return NULL;
}
+
+ if (strstr(mgcp_msg->endpoint, "@") == NULL) {
+ LOGP(DLMGCP, LOGL_ERROR,
+ "Endpoint name (%s) lacks separator (@), can not generate MGCP message\n",
+ mgcp_msg->endpoint);
+ msgb_free(msg);
+ }
+
rc += msgb_printf(msg, " %s", mgcp_msg->endpoint);
}