Skip to content

Commit

Permalink
>Fixing broken memory management.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddpbsd authored and ddp committed Oct 9, 2015
1 parent 88cb5f8 commit e109f90
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/analysisd/decoders/plugins/ossecalert_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void *OSSECAlert_Decoder_Exec(Eventinfo *lf)
char *oa_location;
char *oa_val;
char oa_newlocation[256];
char tmpstr_buffer[4096 + 1];
char *tmp_str = NULL;
void *rule_pointer;

Expand Down Expand Up @@ -166,10 +167,16 @@ void *OSSECAlert_Decoder_Exec(Eventinfo *lf)
while(*tmp_str == ' ')
tmp_str++;

/* Create new full log */
tmpstr_buffer[0] = '\0';
tmpstr_buffer[4095] = '\0';
strncpy(tmpstr_buffer, tmp_str, 4094);


/* Creating new full log. */
free(lf->full_log);
os_strdup(tmp_str, lf->full_log);
lf->full_log = NULL;
os_strdup(tmpstr_buffer, lf->full_log);

lf->log = lf->full_log;


Expand Down

0 comments on commit e109f90

Please sign in to comment.