Skip to content

net_io.c doesn't check return codes #10

@habnabit

Description

@habnabit

In https://github.com/Lyude/SquirrelChat/blob/55d653e5e149524311aaf67d1273fa80405943b9/src/net_io.c there are several calls to send(2) which completely ignore the return code. As http://linux.die.net/man/2/send explains:

On error, -1 is returned, and errno is set appropriately.

If a signal happens to arrive while a send is in progress, errno will be set to EINTR. Since the return code is ignored, that means the write will be completely dropped on the floor. Similarly with the gnutls_write call (which is an alias for gnutls_record_send(3); see http://linux.die.net/man/3/gnutls_record_send for its man page):

If the EINTR is returned by the internal push function (the default is send()} then GNUTLS_E_INTERRUPTED will be returned. If GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must call this function again, with the same parameters; [...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions