Explorar o código

LibPDF: Fix calculation of encryption key

Before this patch, the generation of the encryption key was not working
correctly since the lifetime of the underlying data was too short,
same inputs would give random encryption keys.

Fixes #16668
Simon Danner %!s(int64=2) %!d(string=hai) anos
pai
achega
5fa8068580
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      Userland/Libraries/LibPDF/Encryption.cpp

+ 3 - 3
Userland/Libraries/LibPDF/Encryption.cpp

@@ -256,9 +256,9 @@ ByteBuffer StandardSecurityHandler::compute_encryption_key(ByteBuffer password_s
             n_bytes.ensure_capacity(m_length);
 
             while (n_bytes.size() < m_length) {
-                auto out = md5.peek().bytes();
-                for (size_t j = 0; j < out.size() && n_bytes.size() < m_length; j++)
-                    n_bytes.append(out[j]);
+                auto out = md5.peek();
+                for (size_t j = 0; j < out.data_length() && n_bytes.size() < m_length; j++)
+                    n_bytes.append(out.data[j]);
             }
 
             VERIFY(n_bytes.size() == m_length);