mirror of https://github.com/ecmwf/eccodes.git
SUP-3879: Potential buffer overflow on projection functions
This commit is contained in:
parent
0fc243aea7
commit
332461b3e6
|
@ -161,7 +161,7 @@ static int proj_space_view(grib_handle* h, char* result)
|
||||||
{
|
{
|
||||||
return GRIB_NOT_IMPLEMENTED;
|
return GRIB_NOT_IMPLEMENTED;
|
||||||
// int err = 0;
|
// int err = 0;
|
||||||
// char shape[64] = {0,};
|
// char shape[128] = {0,};
|
||||||
// double latOfSubSatellitePointInDegrees, lonOfSubSatellitePointInDegrees;
|
// double latOfSubSatellitePointInDegrees, lonOfSubSatellitePointInDegrees;
|
||||||
// if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
// if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
||||||
// return err;
|
// return err;
|
||||||
|
@ -190,7 +190,7 @@ static int proj_equatorial_azimuthal_equidistant(grib_handle* h, char* result)
|
||||||
static int proj_lambert_conformal(grib_handle* h, char* result)
|
static int proj_lambert_conformal(grib_handle* h, char* result)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
char shape[64] = {0,};
|
char shape[128] = {0,};
|
||||||
double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0;
|
double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0;
|
||||||
|
|
||||||
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
||||||
|
@ -211,7 +211,7 @@ static int proj_lambert_conformal(grib_handle* h, char* result)
|
||||||
static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result)
|
static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
char shape[64] = {0,};
|
char shape[128] = {0,};
|
||||||
double standardParallel = 0, centralLongitude = 0;
|
double standardParallel = 0, centralLongitude = 0;
|
||||||
|
|
||||||
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
||||||
|
@ -231,7 +231,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result)
|
||||||
double centralLongitude = 0, centralLatitude = 0;
|
double centralLongitude = 0, centralLatitude = 0;
|
||||||
int has_northPole = 0;
|
int has_northPole = 0;
|
||||||
long projectionCentreFlag = 0;
|
long projectionCentreFlag = 0;
|
||||||
char shape[64] = {0,};
|
char shape[128] = {0,};
|
||||||
|
|
||||||
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
@ -252,7 +252,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result)
|
||||||
static int proj_unprojected(grib_handle* h, char* result)
|
static int proj_unprojected(grib_handle* h, char* result)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
//char shape[64] = {0,};
|
//char shape[128] = {0,};
|
||||||
//if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err;
|
//if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err;
|
||||||
//snprintf(result, 1024, "+proj=longlat %s", shape);
|
//snprintf(result, 1024, "+proj=longlat %s", shape);
|
||||||
snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs");
|
snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs");
|
||||||
|
@ -264,7 +264,7 @@ static int proj_mercator(grib_handle* h, char* result)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
double LaDInDegrees = 0;
|
double LaDInDegrees = 0;
|
||||||
char shape[64] = {0,};
|
char shape[128] = {0,};
|
||||||
|
|
||||||
if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS)
|
if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue