OSSP CVS Repository

ossp - Check-in [884]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 884
Date: 2001-Sep-07 12:25:56 (local)
2001-Sep-07 10:25:56 (UTC)
User:thl
Branch:
Comment: fix mandatory sockaddr_in initialization
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_ut_sa.c      1.2 -> 1.3     6 inserted, 0 deleted
ossp-pkg/lmtp2nntp/sa.c      1.8 -> 1.9     6 inserted, 0 deleted

ossp-pkg/l2/l2_ut_sa.c 1.2 -> 1.3

--- l2_ut_sa.c   2001/09/06 17:17:41     1.2
+++ l2_ut_sa.c   2001/09/07 10:25:56     1.3
@@ -107,6 +107,7 @@
         if ((nPath = strlen(cpPath)) >= (sizeof(sau.sun_path)-1))
             return NULL;
         nProto = 0;
+        memset(&sau, 0, sizeof(sau));
         sau.sun_family = AF_LOCAL;
         memcpy(sau.sun_path, cpPath, nPath + 1);
         sa = (struct sockaddr *)&sau;
@@ -144,6 +145,11 @@
             nPort = ntohs(se->s_port);
         }
 
+        /* mandatory initialization */
+        memset(&sa4, 0, sizeof(sa4));
+#ifdef AF_INET6
+        memset(&sa6, 0, sizeof(sa6));
+#endif
         /* resolve host */
         if (inet_pton(AF_INET, cpHost, &sa4.sin_addr.s_addr) == 1) {
             sa4.sin_family = AF_INET;


ossp-pkg/lmtp2nntp/sa.c 1.8 -> 1.9

--- sa.c 2001/09/04 09:46:06     1.8
+++ sa.c 2001/09/07 10:26:08     1.9
@@ -110,6 +110,7 @@
         if ((nPath = strlen(cpPath)) >= (sizeof(sau.sun_path)-1))
             return NULL;
         nProto = 0;
+        memset(&sau, 0, sizeof(sau));
         sau.sun_family = AF_LOCAL;
         memcpy(sau.sun_path, cpPath, nPath + 1);
         sa = (struct sockaddr *)&sau;
@@ -147,6 +148,11 @@
             nPort = ntohs(se->s_port);
         }
 
+        /* mandatory initialization */
+        memset(&sa4, 0, sizeof(sa4));
+#ifdef AF_INET6
+        memset(&sa6, 0, sizeof(sa6));
+#endif
         /* resolve host */
         if (inet_pton(AF_INET, cpHost, &sa4.sin_addr.s_addr) == 1) {
             sa4.sin_family = AF_INET;

CVSTrac 2.0.1