Skip to content
Snippets Groups Projects
  1. Apr 25, 2014
  2. Apr 24, 2014
  3. Apr 23, 2014
  4. Apr 19, 2014
    • Nick Mathewson's avatar
      scan-build: memarea_strndup() undefined behavior · 3b1f7f75
      Nick Mathewson authored
      The memarea_strndup() function would have hit undefined behavior by
      creating an 'end' pointer off the end of a string if it had ever been
      given an 'n' argument bigger than the length of the memory ares that
      it's scanning.  Fortunately, we never did that except in the unit
      tests.  But it's not a safe behavior to leave lying around.
      3b1f7f75
    • Nick Mathewson's avatar
      scan-build: avoid undef behaior in tor_inet_pton · 685d450a
      Nick Mathewson authored
      If we had an address of the form "1.2.3.4" and we tried to pass it to
      tor_inet_pton with AF_INET6, it was possible for our 'eow' pointer to
      briefly move backwards to the point before the start of the string,
      before we moved it right back to the start of the string.  C doesn't
      allow that, and though we haven't yet hit a compiler that decided to
      nuke us in response, it's best to fix.
      
      So, be more explicit about requiring there to be a : before any IPv4
      address part of the IPv6 address.  We would have rejected addresses
      without a : for not being IPv6 later on anyway.
      685d450a
    • Nick Mathewson's avatar
      scan-build: sizeof(ptr*) in a debugging log in ext_orport.c · 78f555a2
      Nick Mathewson authored
      Instead of taking the length of a buffer, we were taking the length of
      a pointer, so that our debugging log would cover only the first
      sizeof(void*) bytes of the client nonce.
      78f555a2
    • Nick Mathewson's avatar
      scan-build: Fix harmless sizeof(ptr) in test_oom.c · 1800e79c
      Nick Mathewson authored
      We meant to using random bytes to fill a buffer, up to 3000 at a
      time. Instead we were taking them sizeof(void*) at a time.
      1800e79c
    • Nick Mathewson's avatar
      scan-build: close stdio FILEs on error in tor-gencert · 5670e38e
      Nick Mathewson authored
      This is harmless, since tor-gencert exits right afterwards, but it's
      best to clean up after ourselves.
      5670e38e
    • Nick Mathewson's avatar
      scan-build: truncate tinytest hexified outputs to 1024 bytes. · 9c9e0796
      Nick Mathewson authored
      scan-build didn't like the unlimited version since we might need to
      overflow size_t to hexify a string that took up half our address
      space. (!)
      9c9e0796
    • Nick Mathewson's avatar
      scan-build: limit hashtable size so it always fits in SSIZE_MAX · 4d51dcda
      Nick Mathewson authored
      scan-build recognizes that in theory there could be a numeric overflow
      here.
      
      This can't numeric overflow can't trigger IRL, since in order to fill a
      hash table with more than P=402653189 buckets with a reasonable load
      factor of 0.5, we'd first have P/2 malloced objects to put in it--- and
      each of those would have to take take at least sizeof(void*) worth of
      malloc overhead plus sizeof(void*) content, which would run you out of
      address space anyway on a 32-bit system.
      4d51dcda
    • Nick Mathewson's avatar
      scan-build: bulletproof last-chance errormsg generation in rendservice.c · d4ad2549
      Nick Mathewson authored
      If 'intro' is NULL in these functions, I'm pretty sure that the
      error message must be set before we hit the end.  But scan-build
      doesn't notice that, and is worried that we'll do a null-pointer
      dereference in the last-chance errormsg generation.
      d4ad2549
    • Nick Mathewson's avatar
      scan-build: Have clear_pending_onions walk the lists more obviously · 1b3bddd0
      Nick Mathewson authored
      As it stands, it relies on the fact that onion_queue_entry_remove
      will magically remove each onionskin from the right list.  This
      patch changes the logic to be more resilient to possible bugs in
      onion_queue_entry_remove, and less confusing to static analysis tools.
      1b3bddd0
    • Nick Mathewson's avatar
      scan-build: in cpuworker, initialize tv_start · 78bc814c
      Nick Mathewson authored
      scan-build doesn't realize that a request can't be timed at the end
      unless it's timed at the start, and so it's not possible for us to
      be subtracting start from end without start being set.
      Nevertheless, let's not confuse it.
      78bc814c
    • Nick Mathewson's avatar
      scan-build: get_proxy_addrport should always set its outputs · 895b6789
      Nick Mathewson authored
      When get_proxy_addrport returned PROXY_NONE, it would leave
      addr/port unset. This is inconsistent, and could (if we used the
      function in a stupid way) lead to undefined behavior. Bugfix on
      5b050a9b, though I don't think it affects tor-as-it-is.
      895b6789
Loading