]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Don't read past end of input when calling write()
authorTerry Wilson <twilson@digium.com>
Mon, 14 Nov 2011 19:10:13 +0000 (19:10 +0000)
committerTerry Wilson <twilson@digium.com>
Mon, 14 Nov 2011 19:10:13 +0000 (19:10 +0000)
commit8a42e7ba418f099d36f22f35baed35c60538444b
treef0e2cb97430f3dc59cd356c91612a74eaba6a433
parentce88defd3c6bc4518ec8091d945fbd85aaa04d7e
Don't read past end of input when calling write()

int blah = 1;
...
write(chan->alertpipe[1], &blah, new_frames * sizeof(blah)) !=
(new_frames * sizeof(blah)))

is only valid when new_frames == 1. Otherwise we start reading into adjacent
variables declared on the stack. The read end discards what is read, so the
values don't matter but it's not a good idea to read past where we want even
though new_frames is almost always 1 and should never be large. This patch is
basically taken out of kpfleming's eventfd branch, as he mentioned that he
remembered fixing it there when I talked to him about this issue.

Review: https://reviewboard.asterisk.org/r/1583/
........

Merged revisions 345163 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@345164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
main/channel.c