[PATCH] osmo-msc[master]: msc_mgcp: use more conceise error msg on truncation

dexter gerrit-no-reply at lists.osmocom.org
Thu Feb 22 11:10:55 UTC 2018


Review at  https://gerrit.osmocom.org/6673

msc_mgcp: use more conceise error msg on truncation

When a truncation check (osmo_strlcpy()) fails handle_error()
is called with MGCP_ERR_NOMEM as cause code. Which finally
results in an "out of memory" message. MGCP_ERR_NOMEM is only
used for failed truncation checks, so it makes sense to choose
a message that describes the cause of the problem better.

- rename MGCP_ERR_NOMEM to MGCP_ERR_TOOLONG
- replace error message string

Change-Id: Ifedb85c1933a30b2aa491b495119919f45782e2c
---
M src/libmsc/msc_mgcp.c
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/73/6673/1

diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c
index f5e40d2..8a7e33f 100644
--- a/src/libmsc/msc_mgcp.c
+++ b/src/libmsc/msc_mgcp.c
@@ -62,7 +62,7 @@
 	MGCP_ERR_UNSUPP_ADDR_FMT,
 	MGCP_ERR_RAN_TIMEOUT,
 	MGCP_ERR_ASS_TIMEOUT,
-	MGCP_ERR_NOMEM,
+	MGCP_ERR_TOOLONG,
 	MGCP_ERR_ASSGMNT_FAIL
 };
 
@@ -76,7 +76,7 @@
 	{MGCP_ERR_UNSUPP_ADDR_FMT, "unsupported network address format used (RAN)"},
 	{MGCP_ERR_RAN_TIMEOUT, "call could not be completed in time (RAN)"},
 	{MGCP_ERR_ASS_TIMEOUT, "assignment could not be completed in time (RAN)"},
-	{MGCP_ERR_NOMEM, "out of memory"},
+	{MGCP_ERR_TOOLONG, "string value too long"},
 	{MGCP_ERR_ASSGMNT_FAIL, "assignment failure (RAN)"},
 	{0, NULL}
 };
@@ -250,7 +250,7 @@
 	};
 	if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >=
 	    MGCP_ENDPOINT_MAXLEN) {
-		handle_error(mgcp_ctx, MGCP_ERR_NOMEM);
+		handle_error(mgcp_ctx, MGCP_ERR_TOOLONG);
 		return;
 	}
 
@@ -346,7 +346,7 @@
 	};
 	if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >=
 	    MGCP_ENDPOINT_MAXLEN) {
-		handle_error(mgcp_ctx, MGCP_ERR_NOMEM);
+		handle_error(mgcp_ctx, MGCP_ERR_TOOLONG);
 		return;
 	}
 
@@ -510,7 +510,7 @@
 	};
 	if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >=
 	    MGCP_ENDPOINT_MAXLEN) {
-		handle_error(mgcp_ctx, MGCP_ERR_NOMEM);
+		handle_error(mgcp_ctx, MGCP_ERR_TOOLONG);
 		return;
 	}
 
@@ -627,7 +627,7 @@
 	};
 	if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >=
 	    MGCP_ENDPOINT_MAXLEN) {
-		handle_error(mgcp_ctx, MGCP_ERR_NOMEM);
+		handle_error(mgcp_ctx, MGCP_ERR_TOOLONG);
 		return;
 	}
 
@@ -708,7 +708,7 @@
 	};
 	if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >=
 	    MGCP_ENDPOINT_MAXLEN) {
-		handle_error(mgcp_ctx, MGCP_ERR_NOMEM);
+		handle_error(mgcp_ctx, MGCP_ERR_TOOLONG);
 		return;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/6673
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifedb85c1933a30b2aa491b495119919f45782e2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>


More information about the gerrit-log mailing list