Opened 6 years ago

Closed 5 years ago

#15546 closed defect (fixed)

handle_control_postdescriptor() modifies a const char

Reported by: donncha Owned by:
Priority: Low Milestone: Tor: 0.2.7.x-final
Component: Core Tor/Tor Version:
Severity: Keywords:
Cc: Yawning Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


handle_control_postdescriptor() in src/or/control.c modifies the const char body. This is a pretty bad practice and might causes errors with non writable memory segments.

static int handle_control_postdescriptor(control_connection_t *conn, 
                                         uint32_t len, const char *body) {
    char *cp = memchr(body, '\n', len);
    smartlist_t *args = smartlist_new();
    tor_assert(cp);*cp++ = '\0';

Child Tickets

Change History (4)

comment:1 Changed 6 years ago by nickm

Milestone: Tor: 0.2.7.x-final
Priority: normalminor

It can't get a non-writable segment as an argument in the current codebase, but yeah, it sure is wrong to do that. We should fix this.

comment:2 Changed 6 years ago by nickm

Status: newneeds_review

My branch bug15546 fixes this; please review?

comment:3 Changed 5 years ago by dgoulet

Happy about it. ack!

comment:4 Changed 5 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

there, merged!

Note: See TracTickets for help on using tickets.