summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-05-31 17:22:04 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-05-31 17:22:04 +0200
commit093e9f5d30f37164dd28d639fedfb059e105e43e (patch)
tree56c2fc11cbf64a59934ea3bf0884e03063ce7caf /apt-pkg/contrib
parent6e235c6640cdc6cb9a8c3eaa1e65a6141f463676 (diff)
* apt-pkg/contrib/cmdline.cc:
- fix segfault in SaveInConfig caused by writing over char[] sizes
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/cmndline.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index 0b16bf51a..5a9944096 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -360,11 +360,11 @@ bool CommandLine::DispatchArg(Dispatch *Map,bool NoMatch)
than nothing after all. */
void CommandLine::SaveInConfig(unsigned int const &argc, char const * const * const argv)
{
- char cmdline[300];
+ char cmdline[100 + argc * 50];
unsigned int length = 0;
bool lastWasOption = false;
bool closeQuote = false;
- for (unsigned int i = 0; i < argc; ++i, ++length)
+ for (unsigned int i = 0; i < argc && length < sizeof(cmdline); ++i, ++length)
{
for (unsigned int j = 0; argv[i][j] != '\0' && length < sizeof(cmdline)-1; ++j, ++length)
{