mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
fixed potential buffer overrun (reported by GuessWho)
This commit is contained in:
parent
7fa687a037
commit
9158ed64ef
@ -104,12 +104,18 @@ static void getPage(const std::string& server_name,std::string& page)
|
||||
#endif
|
||||
|
||||
// envoi
|
||||
sprintf( request,
|
||||
if(snprintf( request,
|
||||
1024,
|
||||
"GET / HTTP/1.0\r\n"
|
||||
"Host: %s:%d\r\n"
|
||||
"Connection: Close\r\n"
|
||||
"\r\n",
|
||||
server_name.c_str(), 80);
|
||||
server_name.c_str(), 80) > 1020)
|
||||
{
|
||||
std::cerr << "ExtAddrFinder: buffer overrun. The server name \"" << server_name << "\" is too long. This is quite unexpected." << std::endl;
|
||||
unix_close(sockfd);
|
||||
return ;
|
||||
}
|
||||
|
||||
if(send(sockfd,request,strlen(request),0)== -1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user