Changeset 1f39ded for filterproc.c


Ignore:
Timestamp:
Mar 11, 2012, 10:57:35 PM (12 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.9
Children:
97cdbaf5
Parents:
39a531d
git-author:
Alex Dehnert <adehnert@MIT.EDU> (01/22/12 21:19:33)
git-committer:
David Benjamin <davidben@mit.edu> (03/11/12 22:57:35)
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

    rf271129 r1f39ded  
    1818  fds[1].fd = wfd;
    1919  fds[1].events = POLLOUT;
     20
     21  if(!out || !*out) {
     22    /* Nothing to write. Close our end so the child doesn't hang waiting. */
     23    close(wfd);
     24    out = NULL;
     25  }
    2026
    2127  while(1) {
Note: See TracChangeset for help on using the changeset viewer.