sepfy / libpeer

WebRTC Library for IoT/Embedded Device using C
MIT License
804 stars 108 forks source link

fix crash due to misinitialization of PeerConnection #12

Closed aldoshkind closed 2 years ago

aldoshkind commented 2 years ago

If PeerConnection is not zeroed upon creation checking for its field to NULL is meaningless (as fields contain garbage) and leads to sigsegvs. For example this happens in peer_connection_ice_recv_cb:

    if(pc->ontrack != NULL) {
      pc->ontrack(buf, len, pc->ontrack_userdata);
    }

This PR contains hotfix for this problem.