Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #22258

Closed (moved)
(moved)
Open
Created May 15, 2017 by teor@teor

Fix an always-true assert in string parsing

const char *err = strchr(cp, ':')+2;
tor_assert(err);

The assert would never work. Even if the function strchr returns NULL, then the pointer err will store an invalid value ((char *)2), but it won't be NULL. It would be correct to write the following:

const char *err = strchr(cp, ':');
tor_assert(err);
err += 2;

However, as I understand, the function strchr will never return NULL, and the check is written just in case.

Reported by Andrey Karpov https://www.viva64.com/en/b/0507/

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking