diff -ur asterisk-1.4.26.1/channels/chan_dahdi.c asterisk-1.4.26.1.new/channels/chan_dahdi.c --- asterisk-1.4.26.1/channels/chan_dahdi.c 2009-09-23 10:36:03.000000000 +0300 +++ asterisk-1.4.26.1.new/channels/chan_dahdi.c 2009-09-23 10:37:41.000000000 +0300 @@ -2185,8 +2185,10 @@ struct dahdi_callerid cid; memset(&cid, 0, sizeof(cid)); - strncpy(cid.cid_num, cid_num, DAHDI_MAX_CID - 1); - strncpy(cid.cid_name, cid_name, DAHDI_MAX_CID - 1); + if (cid_num) + strncpy(cid.cid_num, cid_num, DAHDI_MAX_CID - 1); + if (cid_name) + strncpy(cid.cid_name, cid_name, DAHDI_MAX_CID - 1); ast_verbose("Sending CID IOCTL with %s %s\n", cid_num, cid_name); if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_CALLERID, &cid)) ast_log(LOG_WARNING, "Unable to set caller-id info on '%s': %s\n", ast->name, strerror(errno));