summaryrefslogtreecommitdiff
path: root/bspatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'bspatch.c')
-rw-r--r--bspatch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bspatch.c b/bspatch.c
index b544914..5860a80 100644
--- a/bspatch.c
+++ b/bspatch.c
@@ -62,7 +62,9 @@ int bspatch(const uint8_t* old, int64_t oldsize, uint8_t* new, int64_t newsize,
};
/* Sanity-check */
- if(newpos+ctrl[0]>newsize)
+ if (ctrl[0]<0 || ctrl[0]>INT_MAX ||
+ ctrl[1]<0 || ctrl[1]>INT_MAX ||
+ newpos+ctrl[0]>newsize)
return -1;
/* Read diff string */