From 332461b3e66c1d43aed59c81ce08d72e74fdda5f Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 24 Oct 2023 12:23:51 +0100 Subject: [PATCH] SUP-3879: Potential buffer overflow on projection functions --- src/grib_accessor_class_proj_string.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/grib_accessor_class_proj_string.cc b/src/grib_accessor_class_proj_string.cc index ffd5ed831..00b25c6a3 100644 --- a/src/grib_accessor_class_proj_string.cc +++ b/src/grib_accessor_class_proj_string.cc @@ -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; @@ -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) @@ -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) @@ -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; @@ -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"); @@ -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;