[Pkg-telepathy-commits] [libnice] 214/265: agent: Limit printed length of uname and password in debug output

Simon McVittie smcv at debian.org
Wed May 14 12:05:09 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 354f2470431180b1ecfbee9dd76acd249da06342
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date:   Fri Mar 14 09:20:53 2014 +0000

    agent: Limit printed length of uname and password in debug output
    
    At this point in the code, neither the username nor password are
    nul-terminated, so printing them in the debug output as nul-terminated
    strings can easily result in rubbish being printed after them.
    
    Fix this by specifying the string length in the printf() format string.
    Finally my terminal will no longer ask me to install N’Ko fonts when
    running the libnice tests.
---
 agent/conncheck.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/agent/conncheck.c b/agent/conncheck.c
index 62c0097..d202d69 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -587,12 +587,12 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
             gchar tmpbuf[INET6_ADDRSTRLEN];
             nice_address_to_string (&p->remote->addr, tmpbuf);
             nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', "
-                "socket=%u (c-id:%u), username='%s' (%zd), "
-                "password='%s' (%zd), priority=%u.", agent,
+                "socket=%u (c-id:%u), username='%.*s' (%" G_GSIZE_FORMAT "), "
+                "password='%.*s' (%" G_GSIZE_FORMAT "), priority=%u.", agent,
                 tmpbuf, nice_address_get_port (&p->remote->addr),
                 g_socket_get_fd(((NiceSocket *)p->local->sockptr)->fileno),
-                component->id, uname, uname_len, password, password_len,
-                priority);
+                component->id, (int) uname_len, uname, uname_len,
+                (int) password_len, password, password_len, priority);
           }
           if (uname_len > 0) {
             buf_len = stun_usage_ice_conncheck_create (&agent->stun_agent,
@@ -1673,14 +1673,16 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
     gchar tmpbuf[INET6_ADDRSTRLEN];
     nice_address_to_string (&pair->remote->addr, tmpbuf);
     nice_debug ("Agent %p : STUN-CC REQ to '%s:%u', socket=%u, "
-        "pair=%s (c-id:%u), tie=%llu, username='%s' (%" G_GSIZE_FORMAT "), "
-        "password='%s' (%" G_GSIZE_FORMAT "), priority=%u.", agent,
+        "pair=%s (c-id:%u), tie=%llu, username='%.*s' (%" G_GSIZE_FORMAT "), "
+        "password='%.*s' (%" G_GSIZE_FORMAT "), priority=%u.", agent,
 	     tmpbuf,
              nice_address_get_port (&pair->remote->addr),
              g_socket_get_fd(((NiceSocket *)pair->local->sockptr)->fileno),
 	     pair->foundation, pair->component_id,
 	     (unsigned long long)agent->tie_breaker,
-        uname, uname_len, password, password_len, priority);
+        (int) uname_len, uname, uname_len,
+        (int) password_len, password, password_len,
+        priority);
 
   }
 

-- 
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