summaryrefslogtreecommitdiff
path: root/src/api.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-02-03 08:00:45 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-02-03 08:00:45 +0000
commit5c7ba42d2e90bdd94bb55c80d0787e998fad44f9 (patch)
tree5d4be90b0b95a267e30acf55fc6cce2862b2199b /src/api.c
parent02a50482f806730d8afb6c2c0cc60e3c661b1ea4 (diff)
Notes
Diffstat (limited to 'src/api.c')
-rw-r--r--src/api.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/api.c b/src/api.c
index 0c4732e1520d..68bc2d8e9b0b 100644
--- a/src/api.c
+++ b/src/api.c
@@ -117,7 +117,12 @@ yaml_string_join(
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;