diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-11-08 21:46:43 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-11-08 21:46:43 +0000 |
commit | ef489f81950b664d0bf226459364b29191871109 (patch) | |
tree | 1b4ac2543996678e5bb93d5f5a29dfeeb0935fc5 /channels | |
parent | 648ea2aab953f9026699ccea4a82559cb7c2649e (diff) |
- 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/trunk@155516 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4ef90c7a6..06d8d6f3c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -20132,10 +20132,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; |