Bug#244835: apt-get: hangs with long value in config file
On Tue, Apr 20, 2004 at 10:19:04AM -0700, Matt Zimmerman wrote:
> It sounds like something's wrong in ReadConfigFile; there is a 300-character
> buffer in there used with istream::getline. It looks like it attempts to
> deal with longer lines, but perhaps there is a bug in it.
Ok, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6238
I don't know the c++ library that much, and if this it right or wrong.
The patch below at least lets apt-get barf instead of entering an
infinite loop.
Regards, Gerrit.
--- apt-pkg/contrib/configuration.cc.u 2004-04-24 12:58:47.000000000 +0000
+++ apt-pkg/contrib/configuration.cc 2004-04-24 12:59:00.000000000 +0000
@@ -462,7 +462,7 @@
int CurLine = 0;
bool InComment = false;
- while (F.eof() == false)
+ while (F.good())
{
F.getline(Buffer,sizeof(Buffer));
CurLine++;
@@ -690,7 +690,7 @@
}
if (LineBuffer.empty() == false)
- return _error->Error(_("Syntax error %s:%u: Extra junk at end of file"),FName.c_str(),CurLine);
+ return _error->Error(_("Syntax error %s:%u: Extra junk at end of file or line too long"),FName.c_str(),CurLine);
return true;
}
Reply to: