[Pkg-telepathy-commits] [libnice] 61/265: stun: Fix potential zero-length memset() call
Simon McVittie
smcv at debian.org
Wed May 14 12:04:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository libnice.
commit 649d886143a31caf1d858f8c25a0703e57de74d4
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date: Tue Jan 14 13:57:37 2014 +0000
stun: Fix potential zero-length memset() call
GCC warns about this. Might as well prevent the warning.
---
stun/stunmessage.c | 8 +++++---
1 file 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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git
More information about the Pkg-telepathy-commits
mailing list