Changeset 2e8523b
- Timestamp:
- 2016-12-31T20:40:09Z (8 years ago)
- Branches:
- master
- Children:
- 188b75e, 8768f67
- Parents:
- 7801298
- git-author:
- Jelmer Vernooij <jelmer@…> (28-12-16 13:50:14)
- git-committer:
- dx <dx@…> (31-12-16 20:40:09)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
dcc.c
r7801298 r2e8523b 92 92 struct sockaddr_storage saddr; 93 93 char *errmsg; 94 char host[ HOST_NAME_MAX];94 char host[NI_MAXHOST]; 95 95 char port[6]; 96 96 -
lib/ftutil.c
r7801298 r2e8523b 63 63 if (for_bitlbee_client) { 64 64 *scolon = '\0'; 65 strncpy(host, ftlisten, HOST_NAME_MAX);65 strncpy(host, ftlisten, NI_MAXHOST); 66 66 *scolon = ';'; 67 67 } else { 68 strncpy(host, scolon + 1, HOST_NAME_MAX);68 strncpy(host, scolon + 1, NI_MAXHOST); 69 69 } 70 70 } else { 71 strncpy(host, ftlisten, HOST_NAME_MAX);71 strncpy(host, ftlisten, NI_MAXHOST); 72 72 } 73 73 … … 78 78 } else if (copy_fd >= 0 && getsockname(copy_fd, (struct sockaddr*) &saddrs, &ssize) == 0 && 79 79 (saddrs.ss_family == AF_INET || saddrs.ss_family == AF_INET6) && 80 getnameinfo((struct sockaddr*) &saddrs, ssize, host, HOST_NAME_MAX,80 getnameinfo((struct sockaddr*) &saddrs, ssize, host, NI_MAXHOST, 81 81 NULL, 0, NI_NUMERICHOST) == 0) { 82 82 /* We just took our local address on copy_fd, which is likely to be a … … 84 84 most sensible we can get easily. */ 85 85 } else { 86 ASSERTSOCKOP(gethostname(host, HOST_NAME_MAX + 1), "gethostname()");86 ASSERTSOCKOP(gethostname(host, NI_MAXHOST), "gethostname()"); 87 87 } 88 88 … … 109 109 ( void * ) &(( struct sockaddr_in * ) saddr)->sin_addr.s_addr : 110 110 ( void * ) &(( struct sockaddr_in6 * ) saddr)->sin6_addr.s6_addr, 111 host, HOST_NAME_MAX)) {111 host, NI_MAXHOST)) { 112 112 strcpy(errmsg, "inet_ntop failed on listening socket"); 113 113 return -1; … … 128 128 129 129 /* I hate static-length strings.. */ 130 host[ HOST_NAME_MAX- 1] = '\0';130 host[NI_MAXHOST - 1] = '\0'; 131 131 port[5] = '\0'; 132 132 -
lib/ftutil.h
r7801298 r2e8523b 26 26 #endif 27 27 28 /* Some ifdefs for ulibc and apparently also BSD (Thanks to Whoopie) */29 #ifndef HOST_NAME_MAX30 #include <sys/param.h>31 #ifdef MAXHOSTNAMELEN32 #define HOST_NAME_MAX MAXHOSTNAMELEN33 #else34 #define HOST_NAME_MAX 25535 #endif36 #endif37 38 28 /* This function should be used with care. host should be AT LEAST a 39 char[ HOST_NAME_MAX+1] and port AT LEAST a char[6]. */29 char[NI_MAXHOST+1] and port AT LEAST a char[6]. */ 40 30 int ft_listen(struct sockaddr_storage *saddr_ptr, char *host, char *port, int copy_fd, int for_bitlbee_client, 41 31 char **errptr); -
protocols/jabber/s5bytestream.c
r7801298 r2e8523b 888 888 char *proxy, *next, *errmsg = NULL; 889 889 char port[6]; 890 char host[ HOST_NAME_MAX+ 1];890 char host[NI_MAXHOST + 1]; 891 891 jabber_streamhost_t *sh, *sh2; 892 892 GSList *streamhosts = jd->streamhosts;
Note: See TracChangeset
for help on using the changeset viewer.