Commit 3d79eb52 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

stick to nick's nul/null convention


svn:r6763
parent 0ada963e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);

+2 −2
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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;
+4 −4
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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.
 */
Loading