changeset 1314:6c521260528e

* src/socket.cxx (bind): Pass a copy of the socket address so the stack can modify it without changing the users copy. Bug found by reji@codito.com.
author asl
date Thu, 16 Oct 2003 07:55:31 +0000
parents 68ee1bf08a38
children 49e5a36e706d
files packages/io/fileio/current/ChangeLog packages/io/fileio/current/src/socket.cxx
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-10-16  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/socket.cxx (bind): Pass a copy of the socket address so the
+	stack can modify it without changing the users copy. Bug found by
+	reji@codito.com.
+
 2003-10-06  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/fio.h (CYG_FILEIO_SIGMASK_SET): Fixed a compiler warning
--- a/packages/io/fileio/current/src/socket.cxx
+++ b/packages/io/fileio/current/src/socket.cxx
@@ -267,7 +267,8 @@ static Cyg_Mutex nstab_lock[CYGNUM_FILEI
 
     int ret = 0;
     cyg_file *fp;
-    
+    struct sockaddr sa2 = *sa;
+
     fp = cyg_fp_get( s );
 
     if( fp == NULL )
@@ -279,7 +280,7 @@ static Cyg_Mutex nstab_lock[CYGNUM_FILEI
 
         LOCK_SOCKET( fp );
 
-        ret = ops->bind( fp, sa, len );
+        ret = ops->bind( fp, &sa2, len );
 
         UNLOCK_SOCKET( fp );