ACE_TAO icon indicating copy to clipboard operation
ACE_TAO copied to clipboard

ACE_UNIX_Addr from LSOCK_Dgram::recv is empty

Open eddymhawejj opened this issue 2 years ago • 1 comments

Version 6.5.5 (Appears to be introduced by commit f0272b7047cbeeb9ecc71853e0216d9df9653657 as part of PR https://github.com/DOCGroup/ACE_TAO/pull/868)

Host machine and operating system

RHEL 7.9

Target machine and operating system (if different from host)

Compiler name and version (including patch level)

g++ 10.2.1

The $ACE_ROOT/ace/config.h file

config-linux.h

The $ACE_ROOT/include/makeinclude/platform_macros.GNU file

N/a

Contents of $ACE_ROOT/bin/MakeProjectCreator/config/default.features

N/a

The problem effects:

The problem affects execution of my application

Synopsis

We are using the LSock_Dgram class to communicate between to processes. The application logic requires that we store the address of a sender to be able to reply with another message. The address of the sender is retrieved from an ACE_UNIX_Addr object given as an output parameter to the recv function.

Unfortunately, this address is always empty. The buffer stored in address is assigned a size in the default constructor of ACE_UNIX_Addr. This size is way too small to contain an actual path.

Description

The problem occurs in the following code snippet: Ace/UNIX_Addr.cpp, l. 79:

ACE_UNIX_Addr::ACE_UNIX_Addr (void)
  : ACE_Addr (AF_UNIX,
              **sizeof this->unix_addr_ - sizeof (this->unix_addr_.sun_path**))
{

From the perspective of ACE_Addr the size of the buffer is two when in reality it should be 110.

Sample fix/ workaround

The workaround we discovered was to use the constructor of ACE_UNIX_Addr that takes a string - and then pass in a large empty string. This increases the buffer size sufficiently to contain a path.

eddymhawejj avatar Feb 16 '22 15:02 eddymhawejj

Please extend one of the unit tests under ACE_wrappers/tests as reproducer and open a PR with the test and preferable also a fix for this issue, see https://github.com/DOCGroup/ACE_TAO/wiki/ACE-and-TAO-Commercial-support for when you need any support with this.

jwillemsen avatar Feb 16 '22 15:02 jwillemsen