summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-11-12 15:03:18 +0000
committerKinsey Moore <kmoore@digium.com>2013-11-12 15:03:18 +0000
commit95bc7626aa788b901f93fc1cd3c9d3d7c9ecdd05 (patch)
tree4b6fcb86acbbd86135371d11cc202a26f812251f /channels/chan_dahdi.c
parentd720bc76867aaee9f1a6c3030c98bbb9b6f2af66 (diff)
chan_dahdi: Fix crash during caller ID read
Asterisk will sometimes core dump during caller id read on analog channels due to a negative return value from the read() in my_get_callerid that slips through as a negative length argument to callerid_feed() if the errno returned by DAHDI is ELAST. This change ensures that the negative return is treated properly even when it is ELAST. (closes issue ASTERISK-22746) Reported by: Michael Walton Patches: chan_dahdi_cid_crash_fix.r401410.patch uploaded by Michael Walton (License 6502) ........ Merged revisions 402708 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 402709 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 402710 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index b68299478..2eba958a8 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -1219,11 +1219,8 @@ static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_e
* a failure and die, and returning 2 means no event was received. */
res = read(p->subs[index].dfd, buf, sizeof(buf));
if (res < 0) {
- if (errno != ELAST) {
- ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
- callerid_free(p->cs);
- return -1;
- }
+ ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
+ return -1;
}
if (analog_p->ringt > 0) {