Changeset: f38d81539b0c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f38d81539b0c Modified Files: clients/mapiclient/eventparser.c clients/mapiclient/eventparser.h Branch: default Log Message:
Avoid buffer overflow and tag added diffs (51 lines): diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c --- a/clients/mapiclient/eventparser.c +++ b/clients/mapiclient/eventparser.c @@ -51,6 +51,7 @@ parseArguments(char *call) char *v; malargtop = 0; + malvartop = 0; if( debug) fprintf(stderr,"call:%s\n",call); for( ; c && *c && malargtop < MAXMALARGS; c++){ @@ -68,7 +69,7 @@ parseArguments(char *call) malvariables[malvartop++] = strdup(v); c++; } - if (*c== '\\' && *(c+1) =='"'){ + if (*c && *c== '\\' && *(c+1) =='"'){ c++; c++; // parse string skipping escapes for(l=c; *l; l++){ @@ -78,7 +79,7 @@ parseArguments(char *call) *l= 0; malarguments[malargtop++] = strdup(c); c= l+1; - } else { + } else if(*c) { l = strchr(c, ch = ','); if( l == 0){ l = strchr(c, ch = ')'); @@ -152,6 +153,10 @@ eventparser(char *row, EventRecord *ev) if( c == 0) return -4; ev->pc = atoi(c+1); + c= strchr(c+1,']'); + if ( c == 0) + return -4; + ev->tag = atoi(c+1); } c = strchr(c+1, ','); if (c == 0) diff --git a/clients/mapiclient/eventparser.h b/clients/mapiclient/eventparser.h --- a/clients/mapiclient/eventparser.h +++ b/clients/mapiclient/eventparser.h @@ -81,6 +81,7 @@ extern char *statenames[]; typedef struct { int state; int pc; + int tag; lng eventnr; int thread; lng clkticks; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list