Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#10 [PATCH] Bad behavior on disconnect

open-fixed
dtach (8)
5
2012-07-01
2012-04-14
Enrico Scholz
No

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;
| ...
| }

Discussion

  • Enrico Scholz
    Enrico Scholz
    2012-04-14

     
    Attachments
  • 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.