aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index dd2048fa0..d5063b661 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -11323,6 +11323,12 @@ static void ss7_start_call(struct dahdi_pvt *p, struct dahdi_ss7 *linkset)
#if defined(HAVE_SS7)
static void ss7_apply_plan_to_number(char *buf, size_t size, const struct dahdi_ss7 *ss7, const char *number, const unsigned nai)
{
+ if (ast_strlen_zero(number)) { /* make sure a number exists so prefix isn't placed on an empty string */
+ if (size) {
+ *buf = '\0';
+ }
+ return;
+ }
switch (nai) {
case SS7_NAI_INTERNATIONAL:
snprintf(buf, size, "%s%s", ss7->internationalprefix, number);
@@ -12347,6 +12353,12 @@ static void apply_plan_to_number(char *buf, size_t size, const struct dahdi_pri
snprintf(buf, size, "%s", number);
return;
}
+ if (ast_strlen_zero(number)) { /* make sure a number exists so prefix isn't placed on an empty string */
+ if (size) {
+ *buf = '\0';
+ }
+ return;
+ }
switch (plan) {
case PRI_INTERNATIONAL_ISDN: /* Q.931 dialplan == 0x11 international dialplan => prepend international prefix digits */
snprintf(buf, size, "%s%s", pri->internationalprefix, number);