Skip to content

Commit

Permalink
SUP-3879: Potential buffer overflow on projection functions
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Oct 24, 2023
1 parent 0fc243a commit 332461b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/grib_accessor_class_proj_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static int proj_space_view(grib_handle* h, char* result)
{
return GRIB_NOT_IMPLEMENTED;
// int err = 0;
// char shape[64] = {0,};
// char shape[128] = {0,};
// double latOfSubSatellitePointInDegrees, lonOfSubSatellitePointInDegrees;
// if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
// return err;
Expand Down Expand Up @@ -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)
{
int err = 0;
char shape[64] = {0,};
char shape[128] = {0,};
double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0;

if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
Expand All @@ -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)
{
int err = 0;
char shape[64] = {0,};
char shape[128] = {0,};
double standardParallel = 0, centralLongitude = 0;

if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
Expand All @@ -231,7 +231,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result)
double centralLongitude = 0, centralLatitude = 0;
int has_northPole = 0;
long projectionCentreFlag = 0;
char shape[64] = {0,};
char shape[128] = {0,};

if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
return err;
Expand All @@ -252,7 +252,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result)
static int proj_unprojected(grib_handle* h, char* result)
{
int err = 0;
//char shape[64] = {0,};
//char shape[128] = {0,};
//if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err;
//snprintf(result, 1024, "+proj=longlat %s", shape);
snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs");
Expand All @@ -264,7 +264,7 @@ static int proj_mercator(grib_handle* h, char* result)
{
int err = 0;
double LaDInDegrees = 0;
char shape[64] = {0,};
char shape[128] = {0,};

if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS)
return err;
Expand Down

0 comments on commit 332461b

Please sign in to comment.