From 2f4460b0ea69b51cae9bec66190449aef0310833 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 8 Nov 2008 21:48:23 +0000 Subject: [PATCH] Merged revisions 155516 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r155516 | russell | 2008-11-08 15:46:43 -0600 (Sat, 08 Nov 2008) | 3 lines - Check for failure when putting the packet in the ast_str - fix a spelling error in a header file ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@155517 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 10 ++++++++-- include/asterisk/strings.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 44b9fb2f28..9b29099b93 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -19267,10 +19267,16 @@ static int sipsock_read(int *id, int fd, short events, void *ignore) ast_log(LOG_WARNING, "Recv error: %s\n", strerror(errno)); return 1; } + readbuf[res] = '\0'; - if (!(req.data = ast_str_create(SIP_MIN_PACKET))) + + if (!(req.data = ast_str_create(SIP_MIN_PACKET))) { return 1; - ast_str_set(&req.data, 0, "%s", readbuf); + } + + if (ast_str_set(&req.data, 0, "%s", readbuf) == AST_DYNSTR_BUILD_FAILED) { + return -1; + } req.socket.fd = sipsock; req.socket.type = SIP_TRANSPORT_UDP; diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index f6239121a6..4e76b3bda6 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -548,7 +548,7 @@ struct ast_str *__ast_str_thread_get(struct ast_threadstorage *ts, * interface simplified). */ enum { - /*! An error has occured and the contents of the dynamic string + /*! An error has occurred and the contents of the dynamic string * are undefined */ AST_DYNSTR_BUILD_FAILED = -1, /*! The buffer size for the dynamic string had to be increased, and