Skip to content
Snippets Groups Projects
Commit 633b17bd65f4 authored by Florian Weimer's avatar Florian Weimer
Browse files

yaml_stack_extend: guard against integer overflow

parent 2e633180df14
Branches
No related tags found
No related merge requests found
......@@ -117,7 +117,12 @@
YAML_DECLARE(int)
yaml_stack_extend(void **start, void **top, void **end)
{
void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
void *new_start;
if ((char *)*end - (char *)*start >= INT_MAX / 2)
return 0;
new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
if (!new_start) return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment