Commit 23209039 authored by Bernhard Link's avatar Bernhard Link

properly error out on too long control information

parent 8f33ff7e
......@@ -38,6 +38,7 @@ struct indexfile {
retvalue status;
char *buffer;
int size, ofs, content;
bool failed;
};
extern int verbose;
......@@ -96,6 +97,9 @@ static retvalue indexfile_get(struct indexfile *f) {
bool afternewline, nothingyet;
int bytes_read;
if( f->failed )
return RET_ERROR;
d = f->buffer;
afternewline = true;
nothingyet = true;
......@@ -146,10 +150,20 @@ static retvalue indexfile_get(struct indexfile *f) {
f->content = 0;
if( f->size - f->ofs <= 2048 ) {
/* resize buffer if running low
* (what ridicilous long package chunks do you have?) */
assert(0);
// TODO...
/* Adding code to enlarge the buffer in this case
* is risky as hard to test properly.
*
* Also it is almost certainly caused by some
* mis-representation of the file or perhaps
* some attack. Requesting all existing memory in
* those cases does not sound very useful. */
fprintf(stderr,
"Error parsing %s line %d: Ridiculous long (>= 256K) control chunk!\n",
f->filename,
f->startlinenumber);
f->filed = true;
return RET_ERROR;
}
bytes_read = gzread(f->f, d, f->size - f->ofs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment