summaryrefslogtreecommitdiff
path: root/delta.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-04-07 23:51:55 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-04-07 23:51:55 (GMT)
commitce18135d862b5dbc731d203b27c279529e58b54b (patch)
treefdaa08600484cb4f2d803e010719cfa314b5f0e0 /delta.h
parent9760662f1a7a06516ca249a73e5c1a6fb6c0e26e (diff)
parent98cf8156078eb5256d77d01786863185a1728140 (diff)
downloadgit-ce18135d862b5dbc731d203b27c279529e58b54b.zip
git-ce18135d862b5dbc731d203b27c279529e58b54b.tar.gz
git-ce18135d862b5dbc731d203b27c279529e58b54b.tar.bz2
Merge branch 'maint'
* maint: count-delta: match get_delta_hdr_size() changes. check patch_delta bounds more carefully
Diffstat (limited to 'delta.h')
-rw-r--r--delta.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/delta.h b/delta.h
index a15350d..9464f3e 100644
--- a/delta.h
+++ b/delta.h
@@ -16,7 +16,8 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
* This must be called twice on the delta data buffer, first to get the
* expected reference buffer size, and again to get the result buffer size.
*/
-static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
+static inline unsigned long get_delta_hdr_size(const unsigned char **datap,
+ const unsigned char *top)
{
const unsigned char *data = *datap;
unsigned char cmd;
@@ -26,7 +27,7 @@ static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
cmd = *data++;
size |= (cmd & ~0x80) << i;
i += 7;
- } while (cmd & 0x80);
+ } while (cmd & 0x80 && data < top);
*datap = data;
return size;
}