]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
libssl: Properly deal with an empty error stack in `libssl_get_error_string` 17398/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 May 2026 10:58:14 +0000 (12:58 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 May 2026 10:58:14 +0000 (12:58 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/libssl.cc

index f9b70a40abdca809b595a58a4d7be30ef9ad00a1..4d1c3242230a9e5e7ae82e3594efd786bb7fbd16 100644 (file)
@@ -1400,7 +1400,7 @@ std::string libssl_get_error_string()
   size_t len = BIO_get_mem_data(mem, &p);
   std::string msg(p, len);
   // replace newlines by /
-  if (msg.back() == '\n') {
+  if (!msg.empty() && msg.back() == '\n') {
     msg.pop_back();
   }
   std::replace(msg.begin(), msg.end(), '\n', '/');