summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/configuration.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-12-03 10:29:54 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2021-02-03 17:36:45 +0100
commit03790b071d6a97374a03af36eda5698a143300b0 (patch)
tree49d09c79eb6c05d99072f79dc8fe6ecb6341590e /apt-pkg/contrib/configuration.cc
parent1b3ad3891465f8b72bcedfb4edd513cb74eec7f3 (diff)
Retire and deprecate _strtabexpand
If the Configuration code calling this was any indication, it is hard to use – and even that monster still caused heap-buffer-overflow errors, so instead of trying to fix it, lets just use methods which are far easier to use. The question why this is done at all remains, but is left for another day as an exercise for the reader.
Diffstat (limited to 'apt-pkg/contrib/configuration.cc')
-rw-r--r--apt-pkg/contrib/configuration.cc22
1 files changed, 2 insertions, 20 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 0c98ff304..554307324 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -861,26 +861,8 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio
// The input line with comments stripped.
std::string Fragment;
- // Expand tabs in the input line and remove leading and trailing
- // whitespace.
- {
- const int BufferSize = Input.size() * 8 + 1;
- char *Buffer = new char[BufferSize];
- try
- {
- memcpy(Buffer, Input.c_str(), Input.size() + 1);
-
- _strtabexpand(Buffer, BufferSize);
- _strstrip(Buffer);
- Input = Buffer;
- }
- catch(...)
- {
- delete[] Buffer;
- throw;
- }
- delete[] Buffer;
- }
+ // Expand tabs in the input line and remove leading and trailing whitespace.
+ Input = APT::String::Strip(SubstVar(Input, "\t", " "));
CurLine++;
// Now strip comments; if the whole line is contained in a