Commit 649d8861 authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

stun: Fix potential zero-length memset() call

GCC warns about this. Might as well prevent the warning.
parent c796e9d8
...@@ -357,9 +357,11 @@ stun_message_append (StunMessage *msg, StunAttribute type, size_t length) ...@@ -357,9 +357,11 @@ stun_message_append (StunMessage *msg, StunAttribute type, size_t length)
* to a multiple of 4 for compatibility with old RFC3489 */ * to a multiple of 4 for compatibility with old RFC3489 */
a = stun_setw (a, stun_message_has_cookie (msg) ? length : stun_align (length)); a = stun_setw (a, stun_message_has_cookie (msg) ? length : stun_align (length));
/* Add padding if needed */ /* Add padding if needed. Avoid a zero-length memset() call. */
memset (a + length, ' ', stun_padding (length)); if (stun_padding (length) > 0) {
mlen += stun_padding (length); memset (a + length, ' ', stun_padding (length));
mlen += stun_padding (length);
}
} }
mlen += 4 + length; mlen += 4 + length;
......
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