| Issue 1: | Violacion de segmento en Socket::bufferString2Char(string sbuf) | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Al ejecutar el test de prueba para server_udp (en client pasa lo mismo) me da un error de violacion de segmento.
He conseguido acotarlo a esta funcion pero no consigo arreglarlo
void Socket::bufferString2Char(string sbuf)
{
const char *cadena;
cadena = sbuf.c_str();
cout<<"cadena = " <<cadena<<endl;
strcpy(cbuffer,cadena);
cout<<"cbuffer = " <<cbuffer<<endl;
}
cadena copia correctamente el valor del string. En la funcion strcpy()
es donde estaria el error.
Oct 9, 2012
Project Member
#1
mglg...@gmail.com
Labels:
-Priority-Medium Priority-Critical
Oct 9, 2012
Ya esta solucionado, estaba dando demasiada vuelta
void Socket::bufferString2Char(string sbuf)
{
int i=sbuf.length()+1;
cbuffer = new char[i];
strcpy(cbuffer,sbuf.c_str());
}
Status:
Fixed
|