- Security Audit Report : Patch for Bug No. 5.2.
File c_micasad/lib/communication/UnixIPCClientChannel.cs Determine buffer size needed based on the amount of data being sent.
This commit is contained in:
		| @@ -1,3 +1,9 @@ | |||||||
|  | ------------------------------------------------------------------- | ||||||
|  | Wed Apr 12 09:13:10 MST 2006 - jnorman@novell.com | ||||||
|  | - Security Audit Report : Patch for Bug No. 5.2. | ||||||
|  |   File c_micasad/lib/communication/UnixIPCClientChannel.cs | ||||||
|  |   Determine buffer size needed based on the amount of data being sent. | ||||||
|  |  | ||||||
| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ||||||
| Mon Apr 10 09:41:10 MST 2006 - jnorman@novell.com | Mon Apr 10 09:41:10 MST 2006 - jnorman@novell.com | ||||||
| - Bug 154548. Fix to display firefox secrets in CASAManager. | - Bug 154548. Fix to display firefox secrets in CASAManager. | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ using System.Net; | |||||||
| using System.IO; | using System.IO; | ||||||
| using System.Net.Sockets; | using System.Net.Sockets; | ||||||
| using Mono.Unix; | using Mono.Unix; | ||||||
|  | using System.Text; | ||||||
|  |  | ||||||
| namespace Novell.CASA.MiCasa.Communication | namespace Novell.CASA.MiCasa.Communication | ||||||
| { | { | ||||||
| @@ -109,17 +110,34 @@ namespace Novell.CASA.MiCasa.Communication | |||||||
|                 uint msgLen = BitConverter.ToUInt32(msgLenBytes,0); |                 uint msgLen = BitConverter.ToUInt32(msgLenBytes,0); | ||||||
| 		if( msgLen > 6 ) | 		if( msgLen > 6 ) | ||||||
|                 { |                 { | ||||||
|                     byte[] buf = new byte[msgLen - 6]; | 		    System.Text.Encoding encoding = System.Text.Encoding.ASCII; | ||||||
|                     bytesRecvd = mSocket.Receive (buf); |                     byte[] buf = null; | ||||||
|                     if( 0 == bytesRecvd ) | 		    int bytesAvailable; | ||||||
|  | 		    int totalBytes = 0; | ||||||
|  | 		    int msgLencount = 0; | ||||||
|  | 		    string bufstring = null; | ||||||
|  | 	            byte[] temp = null; | ||||||
|  | 		    while(totalBytes<(msgLen-6)) | ||||||
| 		    { | 		    { | ||||||
|                         return null; | 			    bytesAvailable = mSocket.Available; | ||||||
|  | 			    if( 0 == bytesAvailable) | ||||||
|  |         	            { | ||||||
|  |         	                break; | ||||||
|         	            } |         	            } | ||||||
|  | 			    buf = new byte[bytesAvailable]; | ||||||
|  | 		            bytesRecvd = mSocket.Receive (buf); | ||||||
|  | 			    bufstring = bufstring + encoding.GetString(buf); //keep buffering in a string | ||||||
|  | 			    totalBytes = totalBytes + bytesAvailable; | ||||||
|  | 		    } | ||||||
|  | 		    if(totalBytes==0) | ||||||
|  | 			return null; | ||||||
| 		     | 		     | ||||||
|                     returnBuffer = new byte[msgLen]; | 		    byte[] finalbuf = encoding.GetBytes(bufstring);//finally, convert the string to a byte array of size 'totalBytes' | ||||||
|  | 		    int returnBufferLen = msgIdBytes.Length+msgLenBytes.Length+totalBytes; | ||||||
|  | 		    returnBuffer = new byte[returnBufferLen]; | ||||||
|                     Array.Copy(msgIdBytes,returnBuffer,2); |                     Array.Copy(msgIdBytes,returnBuffer,2); | ||||||
|                     Array.Copy(msgLenBytes,0,returnBuffer,2,4); |                     Array.Copy(msgLenBytes,0,returnBuffer,2,4); | ||||||
|                     Array.Copy(buf,0,returnBuffer,6,buf.Length); |                     Array.Copy(finalbuf,0,returnBuffer,6,finalbuf.Length); | ||||||
| 		    return returnBuffer; | 		    return returnBuffer; | ||||||
|                 } |                 } | ||||||
| 	        else | 	        else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user