Commit fe6330f5 authored by Youness Alaoui's avatar Youness Alaoui

fix an if/else correctly

parent 516886f1
...@@ -234,14 +234,17 @@ socket_send (NiceSocket *sock, const NiceAddress *to, ...@@ -234,14 +234,17 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
nice_address_copy_to_sockaddr (to, (struct sockaddr *)&sa); nice_address_copy_to_sockaddr (to, (struct sockaddr *)&sa);
if (binding) { if (binding) {
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 && if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
len + sizeof(uint32_t) <= sizeof(buffer)) { if (len + sizeof(uint32_t) <= sizeof(buffer)) {
uint16_t len16 = htons ((uint16_t) len); uint16_t len16 = htons ((uint16_t) len);
uint16_t channel16 = htons (binding->channel); uint16_t channel16 = htons (binding->channel);
memcpy (buffer, &channel16, sizeof(uint16_t)); memcpy (buffer, &channel16, sizeof(uint16_t));
memcpy (buffer + sizeof(uint16_t), &len16,sizeof(uint16_t)); memcpy (buffer + sizeof(uint16_t), &len16,sizeof(uint16_t));
memcpy (buffer + sizeof(uint32_t), buf, len); memcpy (buffer + sizeof(uint32_t), buf, len);
msg_len = len + sizeof(uint32_t); msg_len = len + sizeof(uint32_t);
} else {
return 0;
}
} else { } else {
return nice_socket_send (priv->base_socket, &priv->server_addr, len, buf); return nice_socket_send (priv->base_socket, &priv->server_addr, len, buf);
} }
......
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