ECC-405: bufr_new_from_file crash

This commit is contained in:
Shahram Najm 2017-01-05 16:29:16 +00:00
parent 05c9bf5bc0
commit b36d310623
1 changed files with 4 additions and 2 deletions

View File

@ -54,15 +54,17 @@ typedef struct reader {
static int read_the_rest(reader* r,size_t message_length,unsigned char* tmp, int already_read, int check7777)
{
int err = 0;
int err = GRIB_SUCCESS;
size_t buffer_size;
size_t rest;
unsigned char* buffer;
if (message_length==0)
return GRIB_BUFFER_TOO_SMALL;
buffer_size = message_length;
rest=message_length-already_read;
r->message_size=message_length;
buffer = (unsigned char*)r->alloc(r->alloc_data,&buffer_size,&err);
if(err) return err;