[PATCH v2 11/19] modules: Fix uninit value in rtp-send

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

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 at pmeerw.net>
---
 src/modules/rtp/module-rtp-send.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 7f05277..997872e 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -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
-- 
1.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux