Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stack buffer overflows reported in gentoo bug 543310 #2

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions libdiffball/bdelta.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ bdeltaReconstructDCBuff(DCB_SRC_ID src_id, cfile *patchf, CommandBuffer *dcbuff)
cread(patchf, buff, 1);
int_size = buff[0];
v2printf("int_size=%u\n", int_size);
if(int_size < 1 || int_size > 4)
return PATCH_CORRUPT_ERROR;
/* yes, this is an intentional switch fall through. */
switch(int_size) {
case 1: or_mask |= 0x0000ff00;
Expand Down
2 changes: 1 addition & 1 deletion libdiffball/gdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ signed int
gdiffReconstructDCBuff(DCB_SRC_ID src_id, cfile *patchf, CommandBuffer *dcbuff,
unsigned int offset_type)
{
const unsigned int buff_size = 5;
const unsigned int buff_size = 13;
unsigned char buff[buff_size];
off_u32 len, dc_pos=0;
off_u64 ver_pos=0;
Expand Down
2 changes: 1 addition & 1 deletion libdiffball/xdelta1.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ readXDInt(cfile *patchf, unsigned char *buff)
do {
count++;
cread(patchf, buff + count, 1);
} while(buff[count] & 0x80);
} while(count < 31 && buff[count] & 0x80);
for(; count >= 0; count--) {
num <<= 7;
num |= (buff[count] & 0x7f);
Expand Down