Metar: fix test

This commit is contained in:
Shahram Najm 2020-02-06 18:17:52 +00:00
parent 221ab04078
commit 53bf3d9bec
1 changed files with 4 additions and 6 deletions

View File

@ -125,16 +125,14 @@ static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, siz
start += *size; start += *size;
if (e->length != 0) { if (e->length != 0) {
if (start > 0) if (start >= 0)
memcpy(buf, mybuf + start, e->length); memcpy(buf, mybuf + start, e->length);
buf[e->length] = 0; buf[e->length] = 0;
} }
else { else {
if (*size > 0) { memcpy(buf, mybuf, *size);
memcpy(buf, mybuf, *size); if (*size == 1024)
if (*size == 1024) *size = *size - 1; /* ECC-336 */
*size = *size - 1; /* ECC-336 */
}
buf[*size] = 0; buf[*size] = 0;
} }
return buf; return buf;