Project

General

Profile

Actions

Bug #1219

closed

Missing "return 0" after call to close(client) in unix-manager.c, line 299 (UnixCommandAccept(), Suricata 2.0.1)?

Added by Luigi Sandon almost 10 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Affected Versions:
Effort:
Difficulty:
Label:

Description

In this code, after the error condition is checked, client is closed and the function returns with error code (as in many other similar checks).

if (ret < 0) {
        SCLogInfo("Command server: client doesn't send version");
        close(client);
        return 0;
    }

But in the following code after client is closed, the function doesn't return:

if (ret >= (int)(sizeof(buffer)-1)) {
        SCLogInfo("Command server: client message is too long, " 
                  "disconnect him.");
        close(client);
        // MISSING return 0 here???
    }

Then there could be attempts to close client again (and even use it at line 339), otherwise the line

  uclient->fd = client;

is reached, but client could be closed. Previous versions (i.e 1.4.7) may also be affected.

Actions #1

Updated by Victor Julien almost 10 years ago

Looks like it's related to #1182.

Actions #2

Updated by Victor Julien almost 10 years ago

  • Assignee set to Eric Leblond
Actions #3

Updated by Andreas Herz over 8 years ago

Since #1182 is closed, did this resolve as well?

Actions #4

Updated by Eric Leblond over 7 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF