mirror of https://github.com/ecmwf/eccodes.git
GCC 8.3.0: fix all sprintf buffer size issues
This commit is contained in:
parent
fe52826dcc
commit
6eb42de199
|
@ -218,12 +218,12 @@ static void destroy(grib_context* context,grib_action* act)
|
|||
|
||||
static grib_concept_value* get_concept_impl(grib_handle* h,grib_action_concept* self)
|
||||
{
|
||||
char buf[1024]={0,};
|
||||
char buf[4096]={0,};
|
||||
char master[1024]={0,};
|
||||
char local[1024]={0,};
|
||||
char masterDir[1024]={0,};
|
||||
size_t lenMasterDir=1024;
|
||||
char key[1024]={0,};
|
||||
char key[4096]={0,};
|
||||
char* full=0;
|
||||
int id;
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ static void destroy(grib_context* context,grib_action* act)
|
|||
|
||||
static grib_hash_array_value* get_hash_array_impl(grib_handle* h,grib_action* a)
|
||||
{
|
||||
char buf[1024]={0,};
|
||||
char buf[4096]={0,};
|
||||
char master[1024]={0,};
|
||||
char local[1024]={0,};
|
||||
char ecmf[1024]={0,};
|
||||
|
@ -223,7 +223,7 @@ static grib_hash_array_value* get_hash_array_impl(grib_handle* h,grib_action* a)
|
|||
size_t lenLocalDir=1024;
|
||||
char ecmfDir[1024]={0,};
|
||||
size_t lenEcmfDir=1024;
|
||||
char key[1024]={0,};
|
||||
char key[4096]={0,};
|
||||
char* full=0;
|
||||
int id;
|
||||
int err;
|
||||
|
|
|
@ -208,8 +208,8 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
|
|||
GRIB_MUTEX_LOCK(&mutex1);
|
||||
|
||||
if (*masterDir!=0) {
|
||||
char name[1024]={0,};
|
||||
char recomposed[1024]={0,};
|
||||
char name[4096]={0,};
|
||||
char recomposed[4096]={0,};
|
||||
sprintf(name,"%s/%s",masterDir,self->dictionary);
|
||||
grib_recompose_name(h, NULL,name, recomposed,0);
|
||||
filename=grib_context_full_defs_path(c,recomposed);
|
||||
|
@ -219,7 +219,7 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err)
|
|||
|
||||
if (*localDir!=0) {
|
||||
char localRecomposed[1024]={0,};
|
||||
char localName[1024]={0,};
|
||||
char localName[2048]={0,};
|
||||
sprintf(localName,"%s/%s",localDir,self->dictionary);
|
||||
grib_recompose_name(h, NULL,localName, localRecomposed,0);
|
||||
localFilename=grib_context_full_defs_path(c,localRecomposed);
|
||||
|
|
|
@ -306,7 +306,7 @@ static grib_codetable* load_table(grib_accessor_codetable* self)
|
|||
grib_get_string(h,self->localDir,localDir,&len);
|
||||
|
||||
if (*masterDir!=0) {
|
||||
char name[1024]={0,};
|
||||
char name[2048]={0,};
|
||||
sprintf(name,"%s/%s",masterDir,self->tablename);
|
||||
grib_recompose_name(h, NULL,name, recomposed,0);
|
||||
filename=grib_context_full_defs_path(c,recomposed);
|
||||
|
@ -316,7 +316,7 @@ static grib_codetable* load_table(grib_accessor_codetable* self)
|
|||
}
|
||||
|
||||
if (*localDir!=0) {
|
||||
char localName[1024]={0,};
|
||||
char localName[2048]={0,};
|
||||
sprintf(localName,"%s/%s",localDir,self->tablename);
|
||||
grib_recompose_name(h, NULL,localName, localRecomposed,0);
|
||||
localFilename=grib_context_full_defs_path(c,localRecomposed);
|
||||
|
|
|
@ -185,8 +185,8 @@ static grib_trie* load_dictionary(grib_context* c,grib_accessor* a, int* err)
|
|||
if (self->localDir != NULL) grib_get_string(h,self->localDir,localDir,&len);
|
||||
|
||||
if (*masterDir!=0) {
|
||||
char name[1024]={0,};
|
||||
char recomposed[1024]={0,};
|
||||
char name[2048]={0,};
|
||||
char recomposed[2048]={0,};
|
||||
sprintf(name,"%s/%s",masterDir,self->dictionary);
|
||||
grib_recompose_name(h, NULL,name, recomposed,0);
|
||||
filename=grib_context_full_defs_path(c,recomposed);
|
||||
|
@ -195,7 +195,7 @@ static grib_trie* load_dictionary(grib_context* c,grib_accessor* a, int* err)
|
|||
}
|
||||
|
||||
if (*localDir!=0) {
|
||||
char localName[1024]={0,};
|
||||
char localName[2048]={0,};
|
||||
char localRecomposed[1024]={0,};
|
||||
sprintf(localName,"%s/%s",localDir,self->dictionary);
|
||||
grib_recompose_name(h, NULL,localName, localRecomposed,0);
|
||||
|
|
|
@ -614,7 +614,7 @@ static size_t string_length(grib_accessor* a)
|
|||
|
||||
static int pack_long(grib_accessor* a, const long* val, size_t *len)
|
||||
{
|
||||
char buff[100];
|
||||
char buff[256];
|
||||
size_t bufflen=100;
|
||||
char sval[100] = {0};
|
||||
char* p=sval;
|
||||
|
|
|
@ -225,7 +225,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len)
|
|||
|
||||
static int extra_set(grib_accessor* a,long val)
|
||||
{
|
||||
/*TODO chemicals*/
|
||||
/*TODO chemicals*/
|
||||
int ret=0;
|
||||
grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a;
|
||||
char stepType[30]={0,};
|
||||
|
@ -391,6 +391,7 @@ static int extra_set(grib_accessor* a,long val)
|
|||
grib_context_log(a->context,GRIB_LOG_ERROR,"unknown mars.type %d",(int)val);
|
||||
return GRIB_ENCODING_ERROR;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* stream */
|
||||
switch (val) {
|
||||
|
|
|
@ -162,7 +162,7 @@ static void dump(grib_accessor* a,grib_dumper* dumper)
|
|||
grib_accessor_lookup* self = (grib_accessor_lookup*)a;
|
||||
unsigned char bytes[1024] = {0,};
|
||||
char msg[1024]= {0,};
|
||||
char buf[1024];
|
||||
char buf[2048];
|
||||
int i;
|
||||
unsigned long v = 0;
|
||||
|
||||
|
|
|
@ -219,17 +219,17 @@ static grib_smart_table* load_table(grib_accessor_smart_table* self)
|
|||
grib_smart_table* t = NULL;
|
||||
grib_smart_table* next=NULL ;
|
||||
char *filename=0;
|
||||
char name[1024]={0,};
|
||||
char name[2048]={0,};
|
||||
char recomposed[1024]={0,};
|
||||
char localRecomposed[1024]={0,};
|
||||
char *localFilename=0;
|
||||
char extraRecomposed[1024]={0,};
|
||||
char *extraFilename=0;
|
||||
char localName[1024]={0,};
|
||||
char localName[2048]={0,};
|
||||
char masterDir[1024]={0,};
|
||||
char localDir[1024]={0,};
|
||||
char extraDir[1024]={0,};
|
||||
char extraTable[1024]={0,};
|
||||
char extraTable[2048]={0,};
|
||||
size_t len=1024;
|
||||
|
||||
if (self->masterDir != NULL) {
|
||||
|
|
|
@ -145,7 +145,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t *len)
|
|||
{
|
||||
grib_accessor_sprintf* self = (grib_accessor_sprintf*)a;
|
||||
char result[1024] ;
|
||||
char tempBuffer[1024];
|
||||
char tempBuffer[2048];
|
||||
char sres[1024] ;
|
||||
long ires = 0;
|
||||
double dres= 0;
|
||||
|
|
|
@ -306,7 +306,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
|||
int err=0;
|
||||
grib_handle* hm=0;
|
||||
char md5[200]={0,};
|
||||
char fname[210]={0,};
|
||||
char fname[256]={0,};
|
||||
size_t lmd5=32;
|
||||
|
||||
if (!hh) { hh=grib_handle_clone(h); return 0; }
|
||||
|
|
Loading…
Reference in New Issue