mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
stick to nick's nul/null convention
svn:r6763
This commit is contained in:
parent
0ada963ef6
commit
3d79eb52ab
@ -509,7 +509,7 @@ crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest,
|
||||
tor_assert(buf->length >= 0);
|
||||
*dest = tor_malloc(buf->length+1);
|
||||
memcpy(*dest, buf->data, buf->length);
|
||||
(*dest)[buf->length] = 0; /* null terminate it */
|
||||
(*dest)[buf->length] = 0; /* nul terminate it */
|
||||
*len = buf->length;
|
||||
BUF_MEM_free(buf);
|
||||
|
||||
|
@ -878,14 +878,14 @@ fetch_from_buf_http(buf_t *buf,
|
||||
if (headers_out) {
|
||||
*headers_out = tor_malloc(headerlen+1);
|
||||
memcpy(*headers_out,buf->cur,headerlen);
|
||||
(*headers_out)[headerlen] = 0; /* null terminate it */
|
||||
(*headers_out)[headerlen] = 0; /* nul terminate it */
|
||||
}
|
||||
if (body_out) {
|
||||
tor_assert(body_used);
|
||||
*body_used = bodylen;
|
||||
*body_out = tor_malloc(bodylen+1);
|
||||
memcpy(*body_out,buf->cur+headerlen,bodylen);
|
||||
(*body_out)[bodylen] = 0; /* null terminate it */
|
||||
(*body_out)[bodylen] = 0; /* nul terminate it */
|
||||
}
|
||||
buf_remove_from_front(buf, headerlen+bodylen);
|
||||
return 1;
|
||||
|
@ -1919,14 +1919,14 @@ parse_extended_hostname(char *address)
|
||||
s = strrchr(address,'.');
|
||||
if (!s) return 0; /* no dot, thus normal */
|
||||
if (!strcmp(s+1,"exit")) {
|
||||
*s = 0; /* null-terminate it */
|
||||
*s = 0; /* nul-terminate it */
|
||||
return EXIT_HOSTNAME; /* .exit */
|
||||
}
|
||||
if (strcmp(s+1,"onion"))
|
||||
return NORMAL_HOSTNAME; /* neither .exit nor .onion, thus normal */
|
||||
|
||||
/* so it is .onion */
|
||||
*s = 0; /* null-terminate it */
|
||||
*s = 0; /* nul-terminate it */
|
||||
if (strlcpy(query, address, REND_SERVICE_ID_LEN+1) >=
|
||||
REND_SERVICE_ID_LEN+1)
|
||||
goto failed;
|
||||
|
@ -790,7 +790,7 @@ handle_control_getconf(connection_t *conn, uint32_t body_len, const char *body)
|
||||
int v0 = STATE_IS_V0(conn->state);
|
||||
|
||||
questions = smartlist_create();
|
||||
(void) body_len; /* body is null-terminated; so we can ignore len. */
|
||||
(void) body_len; /* body is nul-terminated; so we can ignore len. */
|
||||
if (v0) {
|
||||
smartlist_split_string(questions, body, "\n",
|
||||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||
@ -1160,7 +1160,7 @@ handle_control_mapaddress(connection_t *conn, uint32_t len, const char *body)
|
||||
char *r;
|
||||
size_t sz;
|
||||
int v0 = STATE_IS_V0(conn->state);
|
||||
(void) len; /* body is null-terminated, so it's safe to ignore the length. */
|
||||
(void) len; /* body is nul-terminated, so it's safe to ignore the length. */
|
||||
|
||||
lines = smartlist_create();
|
||||
elts = smartlist_create();
|
||||
@ -1552,7 +1552,7 @@ handle_control_getinfo(connection_t *conn, uint32_t len, const char *body)
|
||||
char *msg = NULL, *ans = NULL;
|
||||
size_t msg_len;
|
||||
int v0 = STATE_IS_V0(conn->state);
|
||||
(void) len; /* body is null-terminated, so it's safe to ignore the length. */
|
||||
(void) len; /* body is nul-terminated, so it's safe to ignore the length. */
|
||||
|
||||
questions = smartlist_create();
|
||||
if (v0)
|
||||
@ -1814,7 +1814,7 @@ handle_control_setpurpose(connection_t *conn, int for_circuits,
|
||||
routerinfo_t *ri = NULL;
|
||||
uint8_t new_purpose;
|
||||
smartlist_t *args = smartlist_create();
|
||||
(void) len; /* body is null-terminated, so it's safe to ignore the length. */
|
||||
(void) len; /* body is nul-terminated, so it's safe to ignore the length. */
|
||||
smartlist_split_string(args, body, " ",
|
||||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||
if (smartlist_len(args)<2) {
|
||||
|
@ -590,7 +590,7 @@ directory_send_command(connection_t *conn, const char *platform,
|
||||
* "\%s [http[s]://]\%s HTTP/1..."
|
||||
* \endverbatim
|
||||
* If it's well-formed, strdup the second \%s into *<b>url</b>, and
|
||||
* null-terminate it. If the url doesn't start with "/tor/", rewrite it
|
||||
* nul-terminate it. If the url doesn't start with "/tor/", rewrite it
|
||||
* so it does. Return 0.
|
||||
* Otherwise, return -1.
|
||||
*/
|
||||
|
@ -941,7 +941,7 @@ dnsworker_main(void *data)
|
||||
crypto_thread_cleanup();
|
||||
spawn_exit();
|
||||
}
|
||||
address[address_len] = 0; /* null terminate it */
|
||||
address[address_len] = 0; /* nul terminate it */
|
||||
|
||||
log_address = esc_for_log(safe_str(address));
|
||||
result = tor_lookup_hostname(address, &ip);
|
||||
|
@ -518,7 +518,7 @@ rend_service_introduce(circuit_t *circuit, const char *request,
|
||||
ptr=memchr(rp_nickname,0,nickname_field_len);
|
||||
if (!ptr || ptr == rp_nickname) {
|
||||
log_warn(LD_PROTOCOL,
|
||||
"Couldn't find a null-padded nickname in INTRODUCE2 cell.");
|
||||
"Couldn't find a nul-padded nickname in INTRODUCE2 cell.");
|
||||
return -1;
|
||||
}
|
||||
if ((version == 0 && !is_legal_nickname(rp_nickname)) ||
|
||||
|
Loading…
Reference in New Issue
Block a user