Im having problems with a server im writting, its possible to cause a buffer overflow.
thanks you for any help you can give.
buff is a std string
Code:
connection::ReadData() {
FD_ZERO(&mask);
FD_SET(s, &mask);
select(s+1,&mask,NULL,NULL,&tv);
char cstr[200]; int mark = 0;
if(FD_ISSET(s, &mask)) {
int num = recv (s, cstr, 200, 0);
for(int i = 0; i < num; i++) {
buff = buff + cstr[i];
}
for(int i = 0; i < strlen(buff.c_str()); i++) {
if( buff[i] == '\n' ) {
buff[i] = '\0';
messageLog.Add(buff, p);
mark = i;
buff = "";
}
}
}
}