Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e873ba8 authored by Ayushi Khopkar's avatar Ayushi Khopkar
Browse files

Bug fix for leak in httplive_fuzzer

Replaced the heap allocation of 'char' with 'string' for 'url' in
order to fix the leak in httplive_fuzzer

Test: ./httplive_fuzzer
Bug: 198017144

Change-Id: I2fe7304f6d5fcda7253b353a91a5220a4738a391
parent fdbce8a0
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -229,17 +229,13 @@ void HttpLiveFuzzer::invokeGetConfig() {

void HttpLiveFuzzer::invokeConnectAsync() {
  string currentFileName = generateFileName();
  size_t fileUrlLength =
      strlen(currentFileName.c_str()) + strlen(kFileUrlPrefix);
  char *url = new char[fileUrlLength + 1];
  strcpy(url, kFileUrlPrefix);
  strcat(url, currentFileName.c_str());
  string url = kFileUrlPrefix + currentFileName;
  string str_1 = mFDP->ConsumeRandomLengthString(kRandomStringLength);
  string str_2 = mFDP->ConsumeRandomLengthString(kRandomStringLength);

  KeyedVector<String8, String8> headers;
  headers.add(String8(str_1.c_str()), String8(str_2.c_str()));
  mLiveSession->connectAsync(url, &headers);
  mLiveSession->connectAsync(url.c_str(), &headers);
}

void HttpLiveFuzzer::invokeLiveSession() {