Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #31545

Closed (moved)
Open
Opened Aug 28, 2019 by teor@teor

CID 1452819: nul-terminated string handling, possibly spurious

Bug introduced by #21003 (moved), copying sponsors and tags.

/src/feature/nodelist/describe.c: 77 in format_node_description()
71       }
72       if (addr32h && has_addr) {
73         memcpy(cp, " and ", 5);
74         cp += 5;
75       }
76       if (has_addr) {
   CID 1452819:    (STRING_NULL)
   Passing unterminated string "cp" to "tor_addr_to_str", which expects a null-terminated string.
77         tor_addr_to_str(cp, addr, TOR_ADDR_BUF_LEN, 1);
78       }
79     
80       return buf;
81     }
82     
/src/feature/nodelist/describe.c: 70 in format_node_description()
64         cp += 4;
65       }
66       if (addr32h) {
67         struct in_addr in;
68         in.s_addr = htonl(addr32h);
69         tor_inet_ntoa(&in, cp, INET_NTOA_BUF_LEN);
   CID 1452819:    (STRING_NULL)
   Passing unterminated string "cp" to "strlen", which expects a null-terminated string.
70         cp += strlen(cp);
71       }
72       if (addr32h && has_addr) {
73         memcpy(cp, " and ", 5);
74         cp += 5;
75       }

I think the best fix for this issue is using strncpy() rather than memcpy().

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.4.2.x-final
Milestone
Tor: 0.4.2.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#31545