security fixes from 0.7.97.2

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1017 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-12-19 17:48:42 +00:00 committed by cras
commit 06a6428d83
6 changed files with 21 additions and 18 deletions

View file

@ -301,8 +301,8 @@ int net_transmit(GIOChannel *handle, const char *data, int len)
g_return_val_if_fail(data != NULL, -1);
err = g_io_channel_write(handle, (char *) data, len, &ret);
if (err == G_IO_ERROR_AGAIN || (err != 0 && errno == EINTR ||
errno == EPIPE))
if (err == G_IO_ERROR_AGAIN ||
(err != 0 && (errno == EINTR || errno == EPIPE)))
return 0;
return err == 0 ? ret : -1;
@ -420,11 +420,11 @@ int net_ip2host(IPADDR *ip, char *host)
unsigned long ip4;
ip4 = ntohl(ip->addr.ip.s_addr);
sprintf(host, "%lu.%lu.%lu.%lu",
(ip4 & 0xff000000UL) >> 24,
(ip4 & 0x00ff0000) >> 16,
(ip4 & 0x0000ff00) >> 8,
(ip4 & 0x000000ff));
g_snprintf(host, MAX_IP_LEN, "%lu.%lu.%lu.%lu",
(ip4 & 0xff000000UL) >> 24,
(ip4 & 0x00ff0000) >> 16,
(ip4 & 0x0000ff00) >> 8,
(ip4 & 0x000000ff));
#endif
return 0;
}

View file

@ -67,7 +67,9 @@ int net_hosterror_notfound(int error);
/* Get socket address/port */
int net_getsockname(GIOChannel *handle, IPADDR *addr, int *port);
/* IPADDR -> char* translation. `host' must be at least MAX_IP_LEN bytes */
int net_ip2host(IPADDR *ip, char *host);
/* char* -> IPADDR translation. */
int net_host2ip(const char *host, IPADDR *ip);
/* Get socket error */