Project

General

Profile

Actions

Bug #1219

closed
LS EL

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

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

Added by Luigi Sandon almost 12 years ago. Updated over 9 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.

VJ Updated by Victor Julien almost 12 years ago Actions #1

Looks like it's related to #1182.

VJ Updated by Victor Julien almost 12 years ago Actions #2

  • Assignee set to Eric Leblond

AH Updated by Andreas Herz over 10 years ago Actions #3

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

EL Updated by Eric Leblond over 9 years ago Actions #4

  • Status changed from New to Closed
Actions

Also available in: PDF Atom