From 310629ee63703ee81f3cc5f09013906b9a355f9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Thu, 19 Feb 2015 15:32:32 -0500
Subject: [PATCH] sipaccount: fix vector size in getSupportedCiphers()

was broken since commit ac3bf29a5a24deacda1fb6a1475356fccfb415ea

Refs #66135

Change-Id: Icbfe09ce37cbd96643cd75bbb72a6cec60a26586
---
 daemon/src/sip/sipaccount.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp
index dd5a5d29a6..6626536143 100644
--- a/daemon/src/sip/sipaccount.cpp
+++ b/daemon/src/sip/sipaccount.cpp
@@ -1542,14 +1542,13 @@ SIPAccount::getSupportedCiphers() const
         CipherArray avail_ciphers(cipherNum);
         if (pj_ssl_cipher_get_availables(&avail_ciphers.front(), &cipherNum) != PJ_SUCCESS)
             RING_ERR("Could not determine cipher list on this system");
-
-        // filter-out 0 ciphers
+        avail_ciphers.resize(cipherNum);
         availCiphers.reserve(cipherNum);
-        std::copy_if(avail_ciphers.begin(), avail_ciphers.end(),
-                     availCiphers.begin(),
-                     [](pj_ssl_cipher& item){ return item > 0; });
+        for (const auto &item : avail_ciphers) {
+            if (item > 0) // 0 doesn't have a name
+                availCiphers.push_back(pj_ssl_cipher_name(item));
+        }
     }
-
     return availCiphers;
 }
 
-- 
GitLab