diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-01-14 13:57:37 +0000 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2014-01-31 01:48:57 -0500 |
commit | 649d886143a31caf1d858f8c25a0703e57de74d4 (patch) | |
tree | aec30cdceadfbf7db1070122c95edace5cf150f4 /stun | |
parent | c796e9d8c86af7a4a2c1ab36d4809e5070644272 (diff) | |
download | libnice-649d886143a31caf1d858f8c25a0703e57de74d4.tar.gz |
stun: Fix potential zero-length memset() call
GCC warns about this. Might as well prevent the warning.
Diffstat (limited to 'stun')
-rw-r--r-- | stun/stunmessage.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/stun/stunmessage.c b/stun/stunmessage.c index b9c54e3..3e55368 100644 --- a/stun/stunmessage.c +++ b/stun/stunmessage.c @@ -357,9 +357,11 @@ stun_message_append (StunMessage *msg, StunAttribute type, size_t length) * to a multiple of 4 for compatibility with old RFC3489 */ a = stun_setw (a, stun_message_has_cookie (msg) ? length : stun_align (length)); - /* Add padding if needed */ - memset (a + length, ' ', stun_padding (length)); - mlen += stun_padding (length); + /* Add padding if needed. Avoid a zero-length memset() call. */ + if (stun_padding (length) > 0) { + memset (a + length, ' ', stun_padding (length)); + mlen += stun_padding (length); + } } mlen += 4 + length; |