mirror of
https://github.com/osmarks/ngircd.git
synced 2025-05-12 20:24:07 +00:00
[Parser]: Don't use Client_Type after command has been processed.
This caused a read from already free'd memory, if the processed command (IRC_QUIT) calls Client_Destroy. (from HEAD)
This commit is contained in:
parent
10cc60d1c2
commit
bc3d1f1761
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: parse.c,v 1.67 2006/04/23 10:37:27 fw Exp $";
|
static char UNUSED id[] = "$Id: parse.c,v 1.67.2.1 2008/02/05 13:15:05 fw Exp $";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
@ -348,7 +348,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
|
|||||||
char str[LINE_LEN];
|
char str[LINE_LEN];
|
||||||
bool result;
|
bool result;
|
||||||
COMMAND *cmd;
|
COMMAND *cmd;
|
||||||
int i;
|
int i, client_type;
|
||||||
|
|
||||||
assert( Idx >= 0 );
|
assert( Idx >= 0 );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
@ -406,6 +406,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd = My_Commands;
|
cmd = My_Commands;
|
||||||
|
client_type = Client_Type( client );
|
||||||
while( cmd->name )
|
while( cmd->name )
|
||||||
{
|
{
|
||||||
/* Befehl suchen */
|
/* Befehl suchen */
|
||||||
@ -414,7 +415,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
|
|||||||
cmd++; continue;
|
cmd++; continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Client_Type( client ) & cmd->type )
|
if( client_type & cmd->type )
|
||||||
{
|
{
|
||||||
/* Command is allowed for this client: call it and count produced bytes */
|
/* Command is allowed for this client: call it and count produced bytes */
|
||||||
Conn_ResetWCounter( );
|
Conn_ResetWCounter( );
|
||||||
@ -422,7 +423,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
|
|||||||
cmd->bytes += Conn_WCounter( );
|
cmd->bytes += Conn_WCounter( );
|
||||||
|
|
||||||
/* Adjust counters */
|
/* Adjust counters */
|
||||||
if( Client_Type( client ) != CLIENT_SERVER ) cmd->lcount++;
|
if( client_type != CLIENT_SERVER ) cmd->lcount++;
|
||||||
else cmd->rcount++;
|
else cmd->rcount++;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user