markparticle / WebServer

C++ Linux WebServer服务器
Apache License 2.0
3.58k stars 733 forks source link

Possible use-after-free on the method HttpConn:Close?? #31

Closed ycaibb closed 3 years ago

ycaibb commented 4 years ago

Dear developers: We find a use-after-free bug on this function HttpConn:Close. It may a false positive. Thank you for your confirmation.

void HttpConn::Close() {
    response_.UnmapFile();
    if(isClose_ == false){
        isClose_ = true; 
        userCount--;
        close(fd_); //free here 
        LOG_INFO("Client[%d](%s:%d) quit, UserCount:%d", fd_, GetIP(), GetPort(), (int)userCount); //use here
    }
}