Module: sip-router
Branch: 4.0
Commit: ac9f143b3cd2422a3fb2c3ca5e29724ed65ab43d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ac9f143…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Mar 15 14:07:04 2013 +0000
modules/outbound: Fixed bug in outbound mod_init
(cherry picked from commit c924645fcfb706fc20ed715a00531d785f99cbde)
---
modules/outbound/ob_mod.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules/outbound/ob_mod.c b/modules/outbound/ob_mod.c
index 37b0a60..4c4e7ea 100644
--- a/modules/outbound/ob_mod.c
+++ b/modules/outbound/ob_mod.c
@@ -85,12 +85,17 @@ static int mod_init(void)
return -1;
}
- if (RAND_bytes((unsigned char *) ob_key.s, OB_KEY_LEN) == 0)
+ if ((ob_key.s = shm_malloc(OB_KEY_LEN)) == NULL)
{
- LM_ERR("unable to get %d cryptographically strong pseudo-"
- "random bytes\n", OB_KEY_LEN);
+ LM_ERR("Failed to allocate memory for flow-token key\n");
+ return -1;
}
ob_key.len = OB_KEY_LEN;
+ if (RAND_bytes((unsigned char *) ob_key.s, ob_key.len) == 0)
+ {
+ LM_ERR("unable to get %d cryptographically strong pseudo-"
+ "random bytes\n", ob_key.len);
+ }
return 0;
}