serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1710385 - /serf/trunk/outgoing.c
Date Sat, 24 Oct 2015 20:45:36 GMT
Author: rhuijben
Date: Sat Oct 24 20:45:35 2015
New Revision: 1710385

URL: http://svn.apache.org/viewvc?rev=1710385&view=rev
Log:
* outgoing.c
  (store_ipaddresses_in_config): Increase buffer space to allow formatting
    ipv6 addresses and check the result to avoid missing APR_ENOSPC and
    thereby setting a string containing something undefined.

Modified:
    serf/trunk/outgoing.c

Modified: serf/trunk/outgoing.c
URL: http://svn.apache.org/viewvc/serf/trunk/outgoing.c?rev=1710385&r1=1710384&r2=1710385&view=diff
==============================================================================
--- serf/trunk/outgoing.c (original)
+++ serf/trunk/outgoing.c Sat Oct 24 20:45:35 2015
@@ -357,16 +357,16 @@ static void store_ipaddresses_in_config(
      apr_sockaddr_t *sa;
 
     if (apr_socket_addr_get(&sa, APR_LOCAL, skt) == APR_SUCCESS) {
-        char buf[32];
-        apr_sockaddr_ip_getbuf(buf, 32, sa);
-        serf_config_set_stringf(config, SERF_CONFIG_CONN_LOCALIP,
-                                "%s:%d", buf, sa->port);
+        char buf[48];
+        if (!apr_sockaddr_ip_getbuf(buf, sizeof(buf), sa))
+            serf_config_set_stringf(config, SERF_CONFIG_CONN_LOCALIP,
+                                    "%s:%d", buf, sa->port);
     }
     if (apr_socket_addr_get(&sa, APR_REMOTE, skt) == APR_SUCCESS) {
-        char buf[32];
-        apr_sockaddr_ip_getbuf(buf, 32, sa);
-        serf_config_set_stringf(config, SERF_CONFIG_CONN_REMOTEIP,
-                               "%s:%d", buf, sa->port);
+        char buf[48];
+        if (!apr_sockaddr_ip_getbuf(buf, sizeof(buf), sa))
+            serf_config_set_stringf(config, SERF_CONFIG_CONN_REMOTEIP,
+                                    "%s:%d", buf, sa->port);
     }
 }
 



Mime
View raw message