mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Git: handle excess of cylinders or weightsystems gracefully
Currently, the git parser happily trashes memory if a git repository contains too many weightsystems or cylinders. This should only happen in testing, but nevertheless try to handle it gracefully and ignore excess cylinders / weightsystems. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
25bee36fcc
commit
9eb860d45d
1 changed files with 6 additions and 0 deletions
|
@ -391,6 +391,9 @@ static void parse_dive_cylinder(char *line, struct membuffer *str, void *_dive)
|
|||
struct dive *dive = _dive;
|
||||
cylinder_t *cylinder = dive->cylinder + cylinder_index;
|
||||
|
||||
if (cylinder_index >= MAX_CYLINDERS)
|
||||
return;
|
||||
|
||||
cylinder->type.description = get_utf8(str);
|
||||
for (;;) {
|
||||
char c;
|
||||
|
@ -423,6 +426,9 @@ static void parse_dive_weightsystem(char *line, struct membuffer *str, void *_di
|
|||
struct dive *dive = _dive;
|
||||
weightsystem_t *ws = dive->weightsystem + weightsystem_index;
|
||||
|
||||
if (weightsystem_index >= MAX_WEIGHTSYSTEMS)
|
||||
return;
|
||||
|
||||
weightsystem_index++;
|
||||
ws->description = get_utf8(str);
|
||||
for (;;) {
|
||||
|
|
Loading…
Reference in a new issue