Output: Fix invalid pointer dereferencing in vcd and gnuplot.

This commit is contained in:
Håvard Espeland 2010-05-04 19:44:39 +02:00
parent bdfc7a8974
commit e273a9040e
2 changed files with 7 additions and 2 deletions

View File

@ -134,7 +134,10 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
char *outbuf, *c;
ctx = o->internal;
outsize = strlen(ctx->header);
outsize = 0;
if (ctx->header)
outsize = strlen(ctx->header);
outbuf = calloc(1, outsize + 1 + 10000); /* FIXME: Use realloc(). */
if (outbuf == NULL)
return SIGROK_ERR_MALLOC;

View File

@ -143,7 +143,9 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
char *outbuf, *c;
ctx = o->internal;
outsize = strlen(ctx->header);
outsize = 0;
if (ctx->header)
outsize = strlen(ctx->header);
outbuf = calloc(1, outsize + 1 + 10000); /* FIXME: Use realloc(). */
if (outbuf == NULL)
return SIGROK_ERR_MALLOC;