My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 1: Violacion de segmento en Socket::bufferString2Char(string sbuf)
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  mglg...@gmail.com
Closed:  Oct 2012


 
Project Member Reported by mglg...@gmail.com, Oct 9, 2012
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
los dos cout que hay no formaran parte de la funcion final, son de prueba
Labels: -Priority-Medium Priority-Critical
Oct 9, 2012
Project Member #2 mglg...@gmail.com
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

Powered by Google Project Hosting