Commit 0f21b23e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridInqXValsPartSerial: check that length <= size.

parent 6da77d75
......@@ -1558,7 +1558,7 @@ size_t gridInqXValsPartSerial(grid_t *gridptr, int start, size_t length, double
if ( gridptr->x.vals )
{
if ( size && xvals )
if ( size && xvals && length <= size )
{
const double *gridptr_xvals = gridptr->vtable->inqXValsPtr(gridptr);
memcpy(xvals, gridptr_xvals+start, length * sizeof (double));
......@@ -1566,6 +1566,8 @@ size_t gridInqXValsPartSerial(grid_t *gridptr, int start, size_t length, double
}
else
size = 0;
return size;
}
static
......@@ -1757,7 +1759,7 @@ size_t gridInqYValsPartSerial(grid_t *gridptr, int start, size_t length, double
if ( gridptr->y.vals )
{
if ( size && yvals )
if ( size && yvals && length <= size )
{
const double *gridptr_yvals = gridptr->vtable->inqYValsPtr(gridptr);
memcpy(yvals, gridptr_yvals+start, length * sizeof (double));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment