paullouisageneau / libdatachannel

C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets
https://libdatachannel.org/
Mozilla Public License 2.0
1.82k stars 365 forks source link

Invalid buffer length in getnameinfo #373

Closed paniksystem closed 3 years ago

paniksystem commented 3 years ago

Second size parameter should be MAX_NUMERICSERV_LEN instead of MAX_NUMERICNODE_LENx2

char nodebuffer[MAX_NUMERICNODE_LEN];
char servbuffer[MAX_NUMERICSERV_LEN];
if (getnameinfo(p->ai_addr, p->ai_addrlen, nodebuffer, MAX_NUMERICNODE_LEN,
    servbuffer, MAX_NUMERICNODE_LEN,
    NI_NUMERICHOST | NI_NUMERICSERV) == 0)

in icetransport (libnice) for both STUN and TURN servers

paullouisageneau commented 3 years ago

Good catch, fixed in https://github.com/paullouisageneau/libdatachannel/commit/412f94dd96711fd6a66770048737eff7f7a687d0