[Bug fix: omniORB2 rejects IOR with zero length object key][3rd attempt]
Sai-Lai Lo
S.Lo@orl.co.uk
Mon, 16 Mar 1998 20:02:54 GMT
Sigh! The previous patch posting is somehow corrupted. Here is a 3rd attempt:
diff -r -c ./src/appl/utils/catior/catior.cc /project/omni/develop/src/appl/utils/catior/catior.cc
*** ./src/appl/utils/catior/catior.cc Mon Mar 16 19:36:45 1998
--- /project/omni/develop/src/appl/utils/catior/catior.cc Fri Mar 13 17:35:42 1998
***************
*** 195,203 ****
begin = (end + 3) & ~(3);
// s[begin] object key length
end = begin + 4;
! if (s.length() <= end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
! {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) s[begin]);
--- 195,207 ----
begin = (end + 3) & ~(3);
// s[begin] object key length
end = begin + 4;
! if (s.length() < end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
!
! if (s.length() == end) {
! p.object_key.length(0);
! }
! else {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) s[begin]);
***************
*** 362,369 ****
cerr << "Exception while processing stringified IOR." << endl;
return -1;
}
-
-
delete[] repoID;
delete profiles;
--- 366,371 ----
diff -r -c ./src/lib/omniORB2/tcpSocket.cc /project/omni/develop/src/lib/omniORB2/tcpSocket.cc
*** ./src/lib/omniORB2/tcpSocket.cc Mon Mar 16 19:36:00 1998
--- /project/omni/develop/src/lib/omniORB2/tcpSocket.cc Fri Mar 13 17:34:18 1998
***************
*** 28,33 ****
--- 28,36 ----
/*
$Log: tcpSocket.cc,v $
+ Revision 1.3 1998/03/13 17:34:16 sll
+ Bug fix. No longer reject an IOR with zero length object key.
+
Revision 1.2 1997/12/12 18:45:33 sll
Added call to print out the version of gatekeeper.
***************
*** 168,176 ****
begin = (end + 3) & ~(3);
// profile.profile_data[begin] object key length
end = begin + 4;
! if (profile.profile_data.length() <= end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
! {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) profile.profile_data[begin]);
--- 171,184 ----
begin = (end + 3) & ~(3);
// profile.profile_data[begin] object key length
end = begin + 4;
! if (profile.profile_data.length() < end)
throw CORBA::MARSHAL(0,CORBA::COMPLETED_NO);
!
! if (profile.profile_data.length() == end) {
! objkeysize = 0;
! objkey = new CORBA::Octet[1];
! }
! else {
CORBA::ULong len;
if (!byteswap) {
len = ((CORBA::ULong &) profile.profile_data[begin]);
***************
*** 187,195 ****
// extract object key
objkeysize = len;
}
- objkey = new CORBA::Octet[objkeysize];
- memcpy((void *)objkey,(void *)&(profile.profile_data[begin]),objkeysize);
addr = new tcpSocketEndpoint(host,port);
return 1;
}
--- 195,203 ----
// extract object key
objkeysize = len;
+ objkey = new CORBA::Octet[objkeysize];
+ memcpy((void *)objkey,(void *)&(profile.profile_data[begin]),objkeysize);
}
addr = new tcpSocketEndpoint(host,port);
return 1;
}
***************
*** 237,245 ****
CORBA::ULong &l = (CORBA::ULong &) profile.profile_data[idx];
l = objkeysize;
}
! idx += 4;
! memcpy((void *)&profile.profile_data[idx],
! (void *)objkey,objkeysize);
}
--- 245,255 ----
CORBA::ULong &l = (CORBA::ULong &) profile.profile_data[idx];
l = objkeysize;
}
! if (objkeysize) {
! idx += 4;
! memcpy((void *)&profile.profile_data[idx],
! (void *)objkey,objkeysize);
! }
}