summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-02-22 08:18:36 +0000
committerNick Mathewson <nickm@torproject.org>2005-02-22 08:18:36 +0000
commit6e6d95b3db091d4ae107c8d4f03354ccadd20757 (patch)
tree1c5799dcfb490b15934adffa42a564d9a47f8a91 /src/or/buffers.c
parente8da6b26b62475114937077e88905be921937554 (diff)
downloadtor-6e6d95b3db091d4ae107c8d4f03354ccadd20757.tar.gz
tor-6e6d95b3db091d4ae107c8d4f03354ccadd20757.zip
Change from inet_ntoa to a threadproof tor_inet_ntoa.
svn:r3656
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 990fc94b15..0abcd9a828 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -448,7 +448,7 @@ int fetch_from_buf_http(buf_t *buf,
*/
int fetch_from_buf_socks(buf_t *buf, socks_request_t *req) {
unsigned char len;
- char *tmpbuf=NULL;
+ char tmpbuf[INET_NTOA_BUF_LEN];
uint32_t destip;
enum {socks4, socks4a} socks4_prot = socks4a;
char *next, *startaddr;
@@ -505,7 +505,7 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req) {
destip = ntohl(*(uint32_t*)(buf->mem+4));
in.s_addr = htonl(destip);
- tmpbuf = inet_ntoa(in);
+ tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
if (strlen(tmpbuf)+1 > MAX_SOCKS_ADDR_LEN) {
log_fn(LOG_WARN,"socks5 IP takes %d bytes, which doesn't fit in %d. Rejecting.",
(int)strlen(tmpbuf)+1,(int)MAX_SOCKS_ADDR_LEN);
@@ -565,7 +565,7 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req) {
if (destip >> 8) {
log_fn(LOG_DEBUG,"socks4: destip not in form 0.0.0.x.");
in.s_addr = htonl(destip);
- tmpbuf = inet_ntoa(in);
+ tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
if (strlen(tmpbuf)+1 > MAX_SOCKS_ADDR_LEN) {
log_fn(LOG_WARN,"socks4 addr (%d bytes) too long. Rejecting.",
(int)strlen(tmpbuf));