#10 [PATCH] Bad behavior on disconnect

dtach (8)

When client disconnects uncleanly, it might happen that an underlying
read() operation returns with an error. This error was interpreted
wrongly because the negative return value was assigned to a variable
of unsigned type and being checked for <= 0. As this condition does
not hold in error case, a packet with wrong len (255) was sent instead
of aborting the client:

| read(0, 0x7fffa6dcfb12, 8) = -1 EIO (Input/output error)
| write(3, "\0\377\0\0\0\0\0\0\0\0", 10) = 10

For reference, the 'pkt' is defined as

| struct packet
| {
| unsigned char type;
| unsigned char len;
| ...
| }


  • Ned T. Crigler

    Ned T. Crigler - 2012-07-01
    • labels: --> dtach
    • assigned_to: nobody --> crigler
    • status: open --> open-fixed
  • Ned T. Crigler

    Ned T. Crigler - 2012-07-01

    I have updated CVS. Please take a look and confirm that this is fixed now.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks