mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Fixed a memory corruption. Coverity issue: 1265729: Out-of-bounds access.
This commit is contained in:
parent
679048ee2a
commit
1f5e6379e4
@ -1165,9 +1165,9 @@ ncio_spx_get(ncio *const nciop,
|
||||
}
|
||||
|
||||
{
|
||||
const size_t rndup = extent % X_ALIGN;
|
||||
if(rndup != 0)
|
||||
extent += X_ALIGN - rndup;
|
||||
const size_t rndup = extent % X_ALIGN;
|
||||
if(rndup != 0)
|
||||
extent += X_ALIGN - rndup;
|
||||
}
|
||||
|
||||
assert(offset % X_ALIGN == 0);
|
||||
@ -1183,7 +1183,7 @@ ncio_spx_get(ncio *const nciop,
|
||||
pxp->bf_extent = 0;
|
||||
}
|
||||
assert(pxp->bf_extent == 0);
|
||||
pxp->bf_base = malloc(extent);
|
||||
pxp->bf_base = malloc(extent+1);
|
||||
if(pxp->bf_base == NULL)
|
||||
return ENOMEM;
|
||||
pxp->bf_extent = extent;
|
||||
|
Loading…
Reference in New Issue
Block a user