Domanda

Continuo a ricevere questo errore ogni volta che io chiamo gethostbyname () nel mio codice C.

==7983== Invalid read of size 1
==7983==    at 0x412AB2C: ____strtoul_l_internal (strtol_l.c:298)
==7983==    by 0x412A46F: strtoul (strtol.c:110)
==7983==    by 0x41D427E: inet_aton (inet_addr.c:143)
==7983==    by 0x41D8FF3: __nss_hostname_digits_dots (digits_dots.c:144)
==7983==    by 0x41DD0F9: gethostbyname (getXXbyYY.c:109)
==7983==    by 0x804BE6F: connexion_function (in  ***************)
==7983==    by 0x8049A8F: main (in ***************)

Tutte le idee? Grazie,

È stato utile?

Soluzione

Si può essere correlato al fatto che gethostbyname non è rientrante e restituisce un oggetto che è condivisa da tutti i thread. Probabilmente è meglio usare getaddrinfo e FreeAddrInfo al posto di gethostbyname .

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top