TAO_CORBALOC_Parser: Length of the string used rather than length of the token

TAO_CORBALOC_Parser: Length of the string used rather than length of the token

Post by Bertin Colpro » Thu, 26 Dec 2002 00:10:26



    TAO VERSION: 1.2.7
    ACE VERSION: 5.2.7

    HOST MACHINE and OPERATING SYSTEM:
        P3, Win2K (SP2)

    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
    COMPILER NAME AND VERSION (AND PATCHLEVEL):
        MS VC++ 6.0 (SP5)

    AREA/CLASS/EXAMPLE AFFECTED:
        TAO_CORBALOC_Parser

    DOES THE PROBLEM AFFECT:
        COMPILATION?
        LINKING?    
        EXECUTION?   Yes

    SYNOPSIS:
        Length of the string used rather than length of the token.

    DESCRIPTION:
        In 'TAO_CORBALOC_Parser::parse_string_assign_helper',
        the cloc_name_ptr string is split into tokens and each token is
        passed to 'TAO_CORBALOC_Parser::assign_key_string'. However, the
        length of cloc_name_ptr is passed as argument of assign_key_string,
        rather than the length of the token.

        Of course, this is harmless for a one-endpoint corbaloc, but if the
        corbaloc as more than one endpoint, a further memcpy will read
passed
        the end of the string, sometimes causing the program to crash
(access
        violation).

    SAMPLE FIX/WORKAROUND:
        Calculate the length of the token (using ACE_OS::strlen()) and pass
        this value to assign_key_string.

<       // Forms the endpoint and calls the mprofile_helper.
<       this->assign_key_string (cloc_name_ptr,
<                                key_string,
<                                addr_list_length,
<                                orb,
<                                mprofile
<                                ACE_ENV_ARG_PARAMETER);
---

Quote:>       CORBA::ULong token_length = ACE_OS::strlen(cloc_name_ptr);

>       // Forms the endpoint and calls the mprofile_helper.
>       this->assign_key_string (cloc_name_ptr,
>                                key_string,
>                                token_length,
>                                orb,
>                                mprofile
>                                ACE_ENV_ARG_PARAMETER);

Bertin Colpron
Software Developer
Interstar Technologies Inc.
http://www.faxserver.com/
 
 
 

1. RS-232 Question - Speed vs Length

How do I calculate maximum effective cable length for a given baud rate?

Also, is there a function to provide error rates (eg. 2% error) for the
given table?

       Length
          10    20    30    40    50    60    70    80    90   100
 Baud  +--------------------------------------------------------------
       |
  300  |
       |
 1200  |
       |
 2400  |
       |
 9600  |
       |
19200  |
       |
38400  |
       +--------------------------------------------------------------

--
 jss - Jon S. Stumpf

2. PC and Amiga Music

3. Do ASCII text files have a record length limitation?

4. Accessing "My Documents"

5. Mastering $1000 for LP length CD!!!

6. Editing a single document with multiple forms (R5)

7. Maximum length of entry name now 32 ;)

8. Congresscritter sighting

9. Extracting The Length of a Field From The Model

10. error while mkelem 0 length file in clearcase

11. Object-oriented approach time length

12. Maximum cable length for Keyboard,mouse and monitor