diff options
author | Elliott Hughes <enh@google.com> | 2019-05-03 22:38:44 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2019-05-04 08:41:12 -0700 |
commit | b17bf521d5c8925c82d9242c331256c95148620b (patch) | |
tree | 6a4ee66e8ffd46584e57aa5c6ae5203e0a3f68c5 /fastboot/fastboot.cpp | |
parent | 7046bcb461c2caf447a12731ef1be2a2ec9d0dd6 (diff) |
libziparchive: report errors on over-long names.
Switch FindEntry and the ZipString constructor to std::string_view. This
lets us accept an over-long name so that we can reject it as too long.
Also fastboot changes to track the API change.
Bug: http://b/129068177
Test: treehugger
Change-Id: I7df7acd1fe2c46380b789c25f8909e0553e2d55e
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r-- | fastboot/fastboot.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index f8f7eb36e..25df4516f 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -502,9 +502,8 @@ static std::vector<char> LoadBootableImage(const std::string& kernel, const std: static bool UnzipToMemory(ZipArchiveHandle zip, const std::string& entry_name, std::vector<char>* out) { - ZipString zip_entry_name(entry_name.c_str()); ZipEntry zip_entry; - if (FindEntry(zip, zip_entry_name, &zip_entry) != 0) { + if (FindEntry(zip, entry_name, &zip_entry) != 0) { fprintf(stderr, "archive does not contain '%s'\n", entry_name.c_str()); return false; } @@ -614,9 +613,8 @@ static void delete_fbemarker_tmpdir(const std::string& dir) { static int unzip_to_file(ZipArchiveHandle zip, const char* entry_name) { unique_fd fd(make_temporary_fd(entry_name)); - ZipString zip_entry_name(entry_name); ZipEntry zip_entry; - if (FindEntry(zip, zip_entry_name, &zip_entry) != 0) { + if (FindEntry(zip, entry_name, &zip_entry) != 0) { fprintf(stderr, "archive does not contain '%s'\n", entry_name); errno = ENOENT; return -1; |