Changeset 4a80a16 for filterproc.c


Ignore:
Timestamp:
Mar 11, 2012, 10:34:04 PM (9 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
release-1.8
Children:
34132f7
Parents:
4f8535e
git-author:
Alex Dehnert <adehnert@MIT.EDU> (01/22/12 21:19:33)
git-committer:
David Benjamin <davidben@mit.edu> (03/11/12 22:34:04)
Message:
Fix hang on empty zcrypt messages

send_receive will never close wfd if out is an empty string.
Consequently, the zcrypt end will keep waiting for something
to encrypt (or decrypt), thereby deadlocking the barnowl.

This closes wfd if we aren't going to write anything to it.
Consequently, zcrypt will terminate quickly, and we'll also
return.

This fixes a deadlock when sending (at least it's the user's
fault) or receiving (this one is a DoS possibility) empty zcrypted
messages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • filterproc.c

    re2cc848 r4a80a16  
    2525  fds[1].fd = wfd;
    2626  fds[1].events = POLLOUT;
     27
     28  if(!out || !*out) {
     29    /* Nothing to write. Close our end so the child doesn't hang waiting. */
     30    close(wfd);
     31    out = NULL;
     32  }
    2733
    2834  while(1) {
Note: See TracChangeset for help on using the changeset viewer.