Stefan Schuermans commited on 2020-05-21 10:23:04
Showing 1 changed files, with 3 additions and 0 deletions.
... | ... |
@@ -16,6 +16,9 @@ static char ** uptev_stringlist_make_ptrs(char *data, size_t sz, |
16 | 16 |
*cnt = 0; |
17 | 17 |
while (pos < sz) { |
18 | 18 |
pos += strlen(data + pos) + 1; |
19 |
+ if (pos > sz) { |
|
20 |
+ break; /* last string overshoots end of data -> ignore it */ |
|
21 |
+ } |
|
19 | 22 |
++*cnt; |
20 | 23 |
} |
21 | 24 |
/* allocate array for pointers */ |
22 | 25 |