mirror of https://github.com/ecmwf/eccodes.git
Metar: fix memory issues
This commit is contained in:
parent
17a82d1019
commit
221ab04078
|
@ -125,13 +125,16 @@ static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, siz
|
|||
start += *size;
|
||||
|
||||
if (e->length != 0) {
|
||||
memcpy(buf, mybuf + start, e->length);
|
||||
if (start > 0)
|
||||
memcpy(buf, mybuf + start, e->length);
|
||||
buf[e->length] = 0;
|
||||
}
|
||||
else {
|
||||
memcpy(buf, mybuf, *size);
|
||||
if (*size == 1024)
|
||||
*size = *size - 1; /* ECC-336 */
|
||||
if (*size > 0) {
|
||||
memcpy(buf, mybuf, *size);
|
||||
if (*size == 1024)
|
||||
*size = *size - 1; /* ECC-336 */
|
||||
}
|
||||
buf[*size] = 0;
|
||||
}
|
||||
return buf;
|
||||
|
|
|
@ -107,8 +107,8 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
|
|||
size_t l1 = sizeof(b1);
|
||||
char b2[1024];
|
||||
size_t l2 = sizeof(b2);
|
||||
const char* v1;
|
||||
const char* v2;
|
||||
const char* v1 = NULL;
|
||||
const char* v2 = NULL;
|
||||
|
||||
grib_expression_string_compare* e = (grib_expression_string_compare*)g;
|
||||
|
||||
|
|
Loading…
Reference in New Issue