Opened 3 years ago

Closed 3 years ago

#22258 closed defect (duplicate)

Fix an always-true assert in string parsing

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: 0.3.1.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points: 0.1
Reviewer: Sponsor:


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

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, ':');
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

Child Tickets

Change History (1)

comment:1 Changed 3 years ago by teor

Resolution: duplicate
Status: newclosed

Duplicate of #22244.

Note: See TracTickets for help on using tickets.