diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-03-16 19:51:55 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-03-16 19:51:55 +0000 |
commit | f7a0d512608577c39f053869b493ebc9dc270810 (patch) | |
tree | a243f55f48c10a68d26eade4bde88307fe522b75 /main | |
parent | 0dee948618d915edb3c7b21f07a739fb7f287efa (diff) |
Merged revisions 310999 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r310999 | twilson | 2011-03-16 14:47:59 -0500 (Wed, 16 Mar 2011) | 18 lines
Merged revisions 310998 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r310998 | twilson | 2011-03-16 14:46:36 -0500 (Wed, 16 Mar 2011) | 11 lines
Fix crash on fdopen failure
See security advisory AST-2011-004
(closes issue #18845)
Reported by: cmaj
Patches:
patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt uploaded by cmaj (license 830)
patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt uploaded by cmaj (license 830)
Tested by: cmaj, twilson
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@311001 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/tcptls.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/main/tcptls.c b/main/tcptls.c index d0ee3b2aa..4f0f08a96 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -139,8 +139,12 @@ static void *handle_tcptls_connection(void *data) * open a FILE * as appropriate. */ if (!tcptls_session->parent->tls_cfg) { - tcptls_session->f = fdopen(tcptls_session->fd, "w+"); - setvbuf(tcptls_session->f, NULL, _IONBF, 0); + if ((tcptls_session->f = fdopen(tcptls_session->fd, "w+"))) { + if(setvbuf(tcptls_session->f, NULL, _IONBF, 0)) { + fclose(tcptls_session->f); + tcptls_session->f = NULL; + } + } } #ifdef DO_SSL else if ( (tcptls_session->ssl = SSL_new(tcptls_session->parent->tls_cfg->ssl_ctx)) ) { |