getGVarString: boundary check

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 2350619364
commit c418758863
+5
View File
@@ -378,6 +378,11 @@ char *getGVarString(char *dest, int idx)
idx = -idx - 1;
}
if (idx >= MAX_GVARS) {
s[0] = '\0';
return s;
}
if (g_model.gvars[idx].name[0])
strAppend(s, g_model.gvars[idx].name, LEN_GVAR_NAME);
else