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

View File

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