Module: sip-router Branch: master Commit: dfbb0af56aec99e3c76476bba16c54cf0d7d928f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dfbb0af5...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Mon Aug 13 22:46:49 2012 +0100
modules/websocket: removed another magic number
---
modules/websocket/ws_handshake.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/websocket/ws_handshake.c b/modules/websocket/ws_handshake.c index 8e7b328..a874eac 100644 --- a/modules/websocket/ws_handshake.c +++ b/modules/websocket/ws_handshake.c @@ -78,8 +78,7 @@ static str str_status_service_unavailable = str_init("Service Unavailable"); #define HDR_BUF_LEN (256) static char headers_buf[HDR_BUF_LEN];
-#define KEY_BUF_LEN (28) -static char key_buf[KEY_BUF_LEN]; +static char key_buf[base64_enc_len(SHA_DIGEST_LENGTH)];
static int ws_send_reply(sip_msg_t *msg, int code, str *reason, str *hdrs) { @@ -289,7 +288,8 @@ int ws_handle_handshake(struct sip_msg *msg) pkg_free(reply_key.s); reply_key.s = key_buf; reply_key.len = base64_enc(sha1, SHA_DIGEST_LENGTH, - (unsigned char *) reply_key.s, KEY_BUF_LEN); + (unsigned char *) reply_key.s, + base64_enc_len(SHA_DIGEST_LENGTH));
/* Add the connection to the WebSocket connection table */ wsconn_add(msg->rcv);