[Spice-devel] [PATCH 1/7] reds: Abort on BN-new failures

Christophe Fergeau cfergeau at redhat.com
Wed Sep 12 07:17:55 PDT 2012


BN_new returns NULL on allocation failures. Given that we abort
on malloc allocation failures, we should also abort here. The
current code will segfault when BN_new fails as it immediatly tries
to use the NULL pointer.
---
 server/reds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 98b316d..993a132 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1811,7 +1811,7 @@ static void openssl_init(RedLinkInfo *link)
     link->tiTicketing.bn = BN_new();
 
     if (!link->tiTicketing.bn) {
-        spice_warning("OpenSSL BIGNUMS alloc failed");
+        spice_error("OpenSSL BIGNUMS alloc failed");
     }
 
     BN_set_word(link->tiTicketing.bn, f4);
-- 
1.7.11.4



More information about the Spice-devel mailing list