Commit 0a4f25e8 authored by Youness Alaoui's avatar Youness Alaoui

If the key len is -1, then do an strlen on the key

parent c7072612
...@@ -176,7 +176,10 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg, ...@@ -176,7 +176,10 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
} }
} }
if (key != NULL && key_len > 0) { if (key != NULL && key_len == -1) {
key_len = strlen (key);
}
if (key != NULL) {
hash = (uint8_t *) stun_message_find (msg, hash = (uint8_t *) stun_message_find (msg,
STUN_ATTRIBUTE_MESSAGE_INTEGRITY, &hlen); STUN_ATTRIBUTE_MESSAGE_INTEGRITY, &hlen);
...@@ -371,6 +374,10 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg, ...@@ -371,6 +374,10 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg,
int i; int i;
stun_transid_t id; stun_transid_t id;
if (key != NULL && key_len == -1) {
key_len = strlen (key);
}
if (key != NULL) { if (key != NULL) {
ptr = stun_message_append (msg, STUN_ATTRIBUTE_MESSAGE_INTEGRITY, 20); ptr = stun_message_append (msg, STUN_ATTRIBUTE_MESSAGE_INTEGRITY, 20);
if (ptr == NULL) { if (ptr == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment