[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Use tor_snprintf, not snprintf
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv6462/src/or
Modified Files:
circuitbuild.c connection_edge.c directory.c dirserv.c main.c
rendservice.c rephist.c router.c routerlist.c routerparse.c
test.c
Log Message:
Use tor_snprintf, not snprintf
Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- circuitbuild.c 27 Oct 2004 05:53:07 -0000 1.43
+++ circuitbuild.c 27 Oct 2004 06:37:34 -0000 1.44
@@ -76,20 +76,20 @@
tor_assert(CIRCUIT_IS_ORIGIN(circ));
tor_assert(circ->cpath);
- snprintf(s, sizeof(buf)-1, "circ (length %d, exit %s): ",
+ tor_snprintf(s, sizeof(buf)-1, "circ (length %d, exit %s): ",
circ->build_state->desired_path_len, circ->build_state->chosen_exit_name);
hop=circ->cpath;
do {
s = buf + strlen(buf);
router = router_get_by_digest(hop->identity_digest);
if(router) {
- snprintf(s, sizeof(buf) - (s - buf), "%s(%s) ",
+ tor_snprintf(s, sizeof(buf) - (s - buf), "%s(%s) ",
router->nickname, states[hop->state]);
} else {
if(circ->purpose == CIRCUIT_PURPOSE_C_REND_JOINED) {
- snprintf(s, sizeof(buf) - (s - buf), "(rendjoin hop)");
+ tor_snprintf(s, sizeof(buf) - (s - buf), "(rendjoin hop)");
} else {
- snprintf(s, sizeof(buf) - (s - buf), "UNKNOWN ");
+ tor_snprintf(s, sizeof(buf) - (s - buf), "UNKNOWN ");
}
}
hop=hop->next;
@@ -1105,7 +1105,7 @@
for(i=0; i < smartlist_len(rl->routers); i++) {
r = smartlist_get(rl->routers, i);
- snprintf(buf, sizeof(buf), "%d", r->or_port);
+ tor_snprintf(buf, sizeof(buf), "%d", r->or_port);
if(!smartlist_string_isin(options.FirewallPorts, buf))
smartlist_add(excluded, r);
}
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- connection_edge.c 19 Oct 2004 17:46:06 -0000 1.218
+++ connection_edge.c 27 Oct 2004 06:37:34 -0000 1.219
@@ -502,12 +502,12 @@
in.s_addr = htonl(client_dns_lookup_entry(ap_conn->socks_request->address));
string_addr = in.s_addr ? inet_ntoa(in) : NULL;
- snprintf(payload,RELAY_PAYLOAD_SIZE,
+ tor_snprintf(payload,RELAY_PAYLOAD_SIZE,
"%s:%d",
string_addr ? string_addr : ap_conn->socks_request->address,
ap_conn->socks_request->port);
} else {
- snprintf(payload,RELAY_PAYLOAD_SIZE,
+ tor_snprintf(payload,RELAY_PAYLOAD_SIZE,
":%d", ap_conn->socks_request->port);
}
payload_len = strlen(payload)+1;
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- directory.c 27 Oct 2004 05:53:07 -0000 1.153
+++ directory.c 27 Oct 2004 06:37:34 -0000 1.154
@@ -131,7 +131,7 @@
* descriptor -- those use Tor. */
if (options.FascistFirewall && purpose == DIR_PURPOSE_UPLOAD_DIR &&
!options.HttpProxy) {
- snprintf(buf,sizeof(buf),"%d",ds->dir_port);
+ tor_snprintf(buf,sizeof(buf),"%d",ds->dir_port);
if (!smartlist_string_isin(options.FirewallPorts, buf))
continue;
}
@@ -325,10 +325,10 @@
if(conn->port == 80) {
strlcpy(hoststring, conn->address, sizeof(hoststring));
} else {
- snprintf(hoststring, sizeof(hoststring),"%s:%d",conn->address, conn->port);
+ tor_snprintf(hoststring, sizeof(hoststring),"%s:%d",conn->address, conn->port);
}
if(options.HttpProxy) {
- snprintf(proxystring, sizeof(proxystring),"http://%s", hoststring);
+ tor_snprintf(proxystring, sizeof(proxystring),"http://%s", hoststring);
} else {
proxystring[0] = 0;
}
@@ -361,7 +361,7 @@
conn->rend_query[payload_len] = 0;
httpcommand = "GET";
- snprintf(url, sizeof(url), "%s/rendezvous/%s", use_newer ? "/tor" : "", payload);
+ tor_snprintf(url, sizeof(url), "%s/rendezvous/%s", use_newer ? "/tor" : "", payload);
/* XXX We're using payload here to mean something other than
* payload of the http post. This is probably bad, and should
@@ -373,11 +373,11 @@
case DIR_PURPOSE_UPLOAD_RENDDESC:
tor_assert(payload);
httpcommand = "POST";
- snprintf(url, sizeof(url), "%s/rendezvous/publish", use_newer ? "/tor" : "");
+ tor_snprintf(url, sizeof(url), "%s/rendezvous/publish", use_newer ? "/tor" : "");
break;
}
- snprintf(tmp, sizeof(tmp), "%s %s%s HTTP/1.0\r\nContent-Length: %lu\r\nHost: %s\r\n\r\n",
+ tor_snprintf(tmp, sizeof(tmp), "%s %s%s HTTP/1.0\r\nContent-Length: %lu\r\nHost: %s\r\n\r\n",
httpcommand,
proxystring,
url,
@@ -758,7 +758,7 @@
log_fn(LOG_DEBUG,"Dumping %sdirectory to client.",
deflated?"deflated ":"");
format_rfc1123_time(date, time(NULL));
- snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: text/plain\r\nContent-Encoding: %s\r\n\r\n",
+ tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: text/plain\r\nContent-Encoding: %s\r\n\r\n",
date,
(int)dlen,
deflated?"deflate":"identity");
@@ -781,7 +781,7 @@
}
format_rfc1123_time(date, time(NULL));
- snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: text/plain\r\n\r\n",
+ tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: text/plain\r\n\r\n",
date,
(int)dlen);
connection_write_to_buf(tmp, strlen(tmp), conn);
@@ -807,7 +807,7 @@
switch(rend_cache_lookup_desc(url+strlen("/tor/rendezvous/"), &descp, &desc_len)) {
case 1: /* valid */
format_rfc1123_time(date, time(NULL));
- snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
+ tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
date,
(int)desc_len); /* can't include descp here, because it's got nuls */
connection_write_to_buf(tmp, strlen(tmp), conn);
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- dirserv.c 27 Oct 2004 06:03:28 -0000 1.102
+++ dirserv.c 27 Oct 2004 06:37:34 -0000 1.103
@@ -616,7 +616,7 @@
dirserv_remove_old_servers(ROUTER_MAX_AGE);
published_on = time(NULL);
format_iso_time(published, published_on);
- snprintf(s, maxlen,
+ tor_snprintf(s, maxlen,
"signed-directory\n"
"published %s\n"
"recommended-software %s\n"
@@ -711,7 +711,7 @@
}
cached_directory_published = when;
if(get_data_directory(&options)) {
- snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options));
+ tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options));
if(write_str_to_file(filename,cached_directory,0) < 0) {
log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
}
@@ -783,7 +783,7 @@
}
tor_free(new_directory);
if(get_data_directory(&options)) {
- snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options));
+ tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options));
if(write_str_to_file(filename,the_directory,0) < 0) {
log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
}
@@ -833,7 +833,7 @@
#endif
published_on = time(NULL);
format_iso_time(published, published_on);
- snprintf(s, len, "network-status\n"
+ tor_snprintf(s, len, "network-status\n"
"published %s\n"
"router-status %s\n"
"opt dir-signing-key %s\n"
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.340
retrieving revision 1.341
diff -u -d -r1.340 -r1.341
--- main.c 27 Oct 2004 05:53:07 -0000 1.340
+++ main.c 27 Oct 2004 06:37:34 -0000 1.341
@@ -757,7 +757,7 @@
}
if(authdir_mode()) {
/* reload the approved-routers file */
- snprintf(keydir,sizeof(keydir),"%s/approved-routers", get_data_directory(&options));
+ tor_snprintf(keydir,sizeof(keydir),"%s/approved-routers", get_data_directory(&options));
log_fn(LOG_INFO,"Reloading approved fingerprints from %s...",keydir);
if(dirserv_parse_fingerprint_file(keydir) < 0) {
log_fn(LOG_WARN, "Error reloading fingerprints. Continuing with old list.");
@@ -772,7 +772,7 @@
dnsworkers_rotate();
/* Rebuild fresh descriptor as needed. */
router_rebuild_descriptor();
- snprintf(keydir,sizeof(keydir),"%s/router.desc", get_data_directory(&options));
+ tor_snprintf(keydir,sizeof(keydir),"%s/router.desc", get_data_directory(&options));
log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir);
if (write_str_to_file(keydir, router_get_my_descriptor(), 0)) {
return -1;
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- rendservice.c 27 Oct 2004 05:53:07 -0000 1.95
+++ rendservice.c 27 Oct 2004 06:37:34 -0000 1.96
@@ -309,7 +309,7 @@
log_fn(LOG_WARN, "Directory name too long: '%s'", s->directory);
return -1;
}
- snprintf(buf, sizeof(buf),"%s.onion\n", s->service_id);
+ tor_snprintf(buf, sizeof(buf),"%s.onion\n", s->service_id);
if (write_str_to_file(fname,buf,0)<0)
return -1;
}
Index: rephist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rephist.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- rephist.c 27 Oct 2004 06:25:29 -0000 1.32
+++ rephist.c 27 Oct 2004 06:37:34 -0000 1.33
@@ -279,8 +279,8 @@
name2 = "(unknown)";
link_history = (link_history_t*) link_history_p;
-/* XXX009 snprintf can return -1 for error also. need to detect. */
- len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
+/* XXX009 tor_snprintf can return -1 for error also. need to detect. */
+ len += tor_snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
link_history->n_extend_ok,
link_history->n_extend_ok+link_history->n_extend_fail);
if (len >= 2048) {
@@ -307,7 +307,7 @@
const char *name1;
tmpfile = tor_malloc(strlen(filename)+5);
- snprintf(tmpfile, strlen(filename)+5, "%s_tmp", filename);
+ tor_snprintf(tmpfile, strlen(filename)+5, "%s_tmp", filename);
f = fopen(tmpfile, "w");
if (!f) goto done;
@@ -527,7 +527,7 @@
for (r=0;r<2;++r) {
b = r?read_array:write_array;
format_iso_time(t, b->next_period-NUM_SECS_BW_SUM_INTERVAL);
- snprintf(cp, len-(cp-buf), "opt %s %s (%d s) ", r?"read-history ":"write-history", t,
+ tor_snprintf(cp, len-(cp-buf), "opt %s %s (%d s) ", r?"read-history ":"write-history", t,
NUM_SECS_BW_SUM_INTERVAL);
cp += strlen(cp);
@@ -542,9 +542,9 @@
for (n=0; n<b->num_maxes_set; ++n,++i) {
while (i >= NUM_TOTALS) i -= NUM_TOTALS;
if (n==(b->num_maxes_set-1))
- snprintf(cp, len-(cp-buf), "%d", b->totals[i]);
+ tor_snprintf(cp, len-(cp-buf), "%d", b->totals[i]);
else
- snprintf(cp, len-(cp-buf), "%d,", b->totals[i]);
+ tor_snprintf(cp, len-(cp-buf), "%d,", b->totals[i]);
cp += strlen(cp);
}
strlcat(cp, "\n", len-(cp-buf));
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- router.c 27 Oct 2004 06:25:29 -0000 1.104
+++ router.c 27 Oct 2004 06:37:34 -0000 1.105
@@ -101,9 +101,9 @@
char fname[512];
char fname_prev[512];
crypto_pk_env_t *prkey;
- snprintf(fname,sizeof(fname),
+ tor_snprintf(fname,sizeof(fname),
"%s/keys/secret_onion_key",get_data_directory(&options));
- snprintf(fname_prev,sizeof(fname_prev),
+ tor_snprintf(fname_prev,sizeof(fname_prev),
"%s/keys/secret_onion_key.old",get_data_directory(&options));
if (!(prkey = crypto_new_pk_env())) {
log(LOG_ERR, "Error creating crypto environment.");
@@ -264,27 +264,27 @@
return -1;
}
/* Check the key directory. */
- snprintf(keydir,sizeof(keydir),"%s/keys", datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/keys", datadir);
if (check_private_dir(keydir, 1)) {
return -1;
}
cp = keydir + strlen(keydir); /* End of string. */
/* 1. Read identity key. Make it if none is found. */
- snprintf(keydir,sizeof(keydir),"%s/keys/identity.key",datadir);
- snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_id_key",datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/keys/identity.key",datadir);
+ tor_snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_id_key",datadir);
log_fn(LOG_INFO,"Reading/making identity key %s...",keydir2);
prkey = init_key_from_file_name_changed(keydir,keydir2);
if (!prkey) return -1;
set_identity_key(prkey);
/* 2. Read onion key. Make it if none is found. */
- snprintf(keydir,sizeof(keydir),"%s/keys/onion.key",datadir);
- snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_onion_key",datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/keys/onion.key",datadir);
+ tor_snprintf(keydir2,sizeof(keydir2),"%s/keys/secret_onion_key",datadir);
log_fn(LOG_INFO,"Reading/making onion key %s...",keydir2);
prkey = init_key_from_file_name_changed(keydir,keydir2);
if (!prkey) return -1;
set_onion_key(prkey);
- snprintf(keydir,sizeof(keydir),"%s/keys/secret_onion_key.old",datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/keys/secret_onion_key.old",datadir);
if (file_status(keydir) == FN_FILE) {
prkey = init_key_from_file(keydir);
if (prkey)
@@ -316,13 +316,13 @@
}
}
- snprintf(keydir,sizeof(keydir),"%s/router.desc", datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/router.desc", datadir);
log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir);
if (write_str_to_file(keydir, mydesc,0)) {
return -1;
}
/* 5. Dump fingerprint to 'fingerprint' */
- snprintf(keydir,sizeof(keydir),"%s/fingerprint", datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/fingerprint", datadir);
log_fn(LOG_INFO,"Dumping fingerprint to %s...",keydir);
tor_assert(strlen(options.Nickname) <= MAX_NICKNAME_LEN);
strlcpy(fingerprint, options.Nickname, sizeof(fingerprint));
@@ -338,7 +338,7 @@
if(!authdir_mode())
return 0;
/* 6. [authdirserver only] load approved-routers file */
- snprintf(keydir,sizeof(keydir),"%s/approved-routers", datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/approved-routers", datadir);
log_fn(LOG_INFO,"Loading approved fingerprints from %s...",keydir);
if(dirserv_parse_fingerprint_file(keydir) < 0) {
log_fn(LOG_ERR, "Error loading fingerprints");
@@ -350,7 +350,7 @@
add_trusted_dir_server(options.Address, (uint16_t)options.DirPort, digest);
}
/* 7. [authdirserver only] load old directory, if it's there */
- snprintf(keydir,sizeof(keydir),"%s/cached-directory", datadir);
+ tor_snprintf(keydir,sizeof(keydir),"%s/cached-directory", datadir);
log_fn(LOG_INFO,"Loading cached directory from %s...",keydir);
cp = read_file_to_str(keydir,0);
if(!cp) {
@@ -568,7 +568,7 @@
*/
void get_platform_str(char *platform, size_t len)
{
- snprintf(platform, len-1, "Tor %s on %s",
+ tor_snprintf(platform, len-1, "Tor %s on %s",
VERSION, get_uname());
platform[len-1] = '\0';
return;
@@ -643,14 +643,14 @@
char *s = smartlist_join_strings(router->declared_family, " ", 0);
size_t n = strlen(s) + strlen("opt family ") + 2; /* 1 for \n, 1 for \0. */
family_line = tor_malloc(n);
- snprintf(family_line, n, "opt family %s\n", s);
+ tor_snprintf(family_line, n, "opt family %s\n", s);
tor_free(s);
} else {
family_line = tor_strdup("");
}
/* Generate the easy portion of the router descriptor. */
- result = snprintf(s, maxlen,
+ result = tor_snprintf(s, maxlen,
"router %s %s %d %d %d\n"
"platform %s\n"
"published %s\n"
@@ -679,14 +679,14 @@
tor_free(bandwidth_usage);
if(result < 0 || (size_t)result >= maxlen) {
- /* apparently different glibcs do different things on snprintf error.. so check both */
+ /* apparently different glibcs do different things on tor_snprintf error.. so check both */
return -1;
}
/* From now on, we use 'written' to remember the current length of 's'. */
written = result;
if (options.ContactInfo && strlen(options.ContactInfo)) {
- result = snprintf(s+written,maxlen-written, "opt contact %s\n",
+ result = tor_snprintf(s+written,maxlen-written, "opt contact %s\n",
options.ContactInfo);
if (result<0 || result+written > maxlen)
return -1;
@@ -697,18 +697,18 @@
for(tmpe=router->exit_policy; tmpe; tmpe=tmpe->next) {
in.s_addr = htonl(tmpe->addr);
/* Write: "accept 1.2.3.4" */
- result = snprintf(s+written, maxlen-written, "%s %s",
+ result = tor_snprintf(s+written, maxlen-written, "%s %s",
tmpe->policy_type == EXIT_POLICY_ACCEPT ? "accept" : "reject",
tmpe->msk == 0 ? "*" : inet_ntoa(in));
if(result < 0 || result+written > maxlen) {
- /* apparently different glibcs do different things on snprintf error.. so check both */
+ /* apparently different glibcs do different things on tor_snprintf error.. so check both */
return -1;
}
written += result;
if (tmpe->msk != 0xFFFFFFFFu && tmpe->msk != 0) {
/* Write "/255.255.0.0" */
in.s_addr = htonl(tmpe->msk);
- result = snprintf(s+written, maxlen-written, "/%s", inet_ntoa(in));
+ result = tor_snprintf(s+written, maxlen-written, "/%s", inet_ntoa(in));
if (result<0 || result+written > maxlen)
return -1;
written += result;
@@ -721,13 +721,13 @@
written += 3;
} else if (tmpe->prt_min == tmpe->prt_max) {
/* There is only one port; write ":80". */
- result = snprintf(s+written, maxlen-written, ":%d\n", tmpe->prt_min);
+ result = tor_snprintf(s+written, maxlen-written, ":%d\n", tmpe->prt_min);
if (result<0 || result+written > maxlen)
return -1;
written += result;
} else {
/* There is a range of ports; write ":79-80". */
- result = snprintf(s+written, maxlen-written, ":%d-%d\n", tmpe->prt_min,
+ result = tor_snprintf(s+written, maxlen-written, ":%d-%d\n", tmpe->prt_min,
tmpe->prt_max);
if (result<0 || result+written > maxlen)
return -1;
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- routerlist.c 27 Oct 2004 05:53:07 -0000 1.167
+++ routerlist.c 27 Oct 2004 06:37:34 -0000 1.168
@@ -50,7 +50,7 @@
char filename[512];
if (get_data_directory(&options)) {
char *s;
- snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options));
+ tor_snprintf(filename,sizeof(filename),"%s/cached-directory", get_data_directory(&options));
s = read_file_to_str(filename,0);
if (s) {
tor_strstrip(s,"\r"); /* XXXX This is a bug workaround for win32. */
@@ -167,7 +167,7 @@
if(requireothers && router_is_me(router))
continue;
if(fascistfirewall) {
- snprintf(buf,sizeof(buf),"%d",router->dir_port);
+ tor_snprintf(buf,sizeof(buf),"%d",router->dir_port);
if (!smartlist_string_isin(options.FirewallPorts, buf))
continue;
}
@@ -202,7 +202,7 @@
!memcmp(me->identity_digest, d->digest, DIGEST_LEN))
continue;
if (fascistfirewall) {
- snprintf(buf,sizeof(buf),"%d",d->dir_port);
+ tor_snprintf(buf,sizeof(buf),"%d",d->dir_port);
if (!smartlist_string_isin(options.FirewallPorts, buf))
continue;
}
Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- routerparse.c 27 Oct 2004 06:25:29 -0000 1.65
+++ routerparse.c 27 Oct 2004 06:37:34 -0000 1.66
@@ -1032,7 +1032,7 @@
newe = tor_malloc_zero(sizeof(struct exit_policy_t));
newe->string = tor_malloc(8+strlen(arg));
- snprintf(newe->string, 8+strlen(arg), "%s %s",
+ tor_snprintf(newe->string, 8+strlen(arg), "%s %s",
(tok->tp == K_REJECT) ? "reject" : "accept", arg);
newe->policy_type = (tok->tp == K_REJECT) ? EXIT_POLICY_REJECT
: EXIT_POLICY_ACCEPT;
Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- test.c 27 Oct 2004 05:53:07 -0000 1.134
+++ test.c 27 Oct 2004 06:37:34 -0000 1.135
@@ -50,7 +50,7 @@
int r;
if (is_setup) return;
- snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d", (int) getpid());
+ tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d", (int) getpid());
#ifdef MS_WINDOWS
r = mkdir(temp_dir);
#else
@@ -69,7 +69,7 @@
{
static char buf[1024];
setup_directory();
- snprintf(buf,sizeof(buf),"%s/%s",temp_dir,name);
+ tor_snprintf(buf,sizeof(buf),"%s/%s",temp_dir,name);
return buf;
}