]> code.delx.au - pulseaudio/commitdiff
modules: Fix uninit value in rtp-send
authorPeter Meerwald <p.meerwald@bct-electronic.com>
Mon, 16 Dec 2013 16:22:10 +0000 (17:22 +0100)
committerPeter Meerwald <p.meerwald@bct-electronic.com>
Fri, 20 Dec 2013 11:55:17 +0000 (12:55 +0100)
https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8803&defectInstanceId=3705&mergedDefectId=591292&eventIds=3705-36&eventId=3705-36

see http://silviocesare.wordpress.com/2007/10/22/setting-sin_zero-to-0-in-struct-sockaddr_in/

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
src/modules/rtp/module-rtp-send.c

index 7f052778d990938fb05876d4c4ed3472f17d69e4..997872e054c069740689f97071731403226e786a 100644 (file)
@@ -251,11 +251,14 @@ int pa__init(pa_module*m) {
     if (inet_pton(AF_INET, src_addr, &src_sa4.sin_addr) > 0) {
         src_sa4.sin_family = af = AF_INET;
         src_sa4.sin_port = htons(0);
+        memset(&src_sa4.sin_zero, 0, sizeof(src_sa4.sin_zero));
         src_sap_sa4 = src_sa4;
 #ifdef HAVE_IPV6
     } else if (inet_pton(AF_INET6, src_addr, &src_sa6.sin6_addr) > 0) {
         src_sa6.sin6_family = af = AF_INET6;
         src_sa6.sin6_port = htons(0);
+        src_sa6.sin6_flowinfo = 0;
+        src_sa6.sin6_scope_id = 0;
         src_sap_sa6 = src_sa6;
 #endif
     } else {
@@ -270,12 +273,15 @@ int pa__init(pa_module*m) {
     if (inet_pton(AF_INET, dst_addr, &dst_sa4.sin_addr) > 0) {
         dst_sa4.sin_family = af = AF_INET;
         dst_sa4.sin_port = htons((uint16_t) port);
+        memset(&dst_sa4.sin_zero, 0, sizeof(dst_sa4.sin_zero));
         dst_sap_sa4 = dst_sa4;
         dst_sap_sa4.sin_port = htons(SAP_PORT);
 #ifdef HAVE_IPV6
     } else if (inet_pton(AF_INET6, dst_addr, &dst_sa6.sin6_addr) > 0) {
         dst_sa6.sin6_family = af = AF_INET6;
         dst_sa6.sin6_port = htons((uint16_t) port);
+        dst_sa6.sin6_flowinfo = 0;
+        src_sa6.sin6_scope_id = 0;
         dst_sap_sa6 = dst_sa6;
         dst_sap_sa6.sin6_port = htons(SAP_PORT);
 #endif