diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 3643d67e22170016a2d68b8fab6b8d9993ffeec6..293b8f8cb55750f687b7aebcee91817bdcd83440 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -821,7 +821,9 @@ void misdn_cfg_get_config_string (int port, enum misdn_cfg_elements elem, char*
 				for (; iter; iter = iter->next) {
 					strncat(tempbuf, iter->msn, sizeof(tempbuf) - strlen(tempbuf) - 1);
 				}
-				tempbuf[strlen(tempbuf)-2] = 0;
+				if (strlen(tempbuf) > 1) {
+					tempbuf[strlen(tempbuf)-2] = 0;
+				}
 			}
 			snprintf(buf, bufsize, " -> msns: %s", *tempbuf ? tempbuf : "none");
 			break;