Menu

#1 data assumed to be null terminated

open
nobody
None
9
2002-10-21
2002-07-23
Alan Parker
No

This problem shows itself on windows and seems to be
caused by line 1603 in OleDND.cpp:

dataObj = TkDND_CreateDataObjAccordingToType
(dnd->DesiredTypeStr, NULL,
(unsigned char*) str, strlen(str));

here we see a TCL data object being created from an
unknown type, but the size of the type(byte-array) is
determined using strlen, which assumes the data is null
terminated. Unfortunaltly our data is not null terminated
and uses the first four bytes to store the size of the data
in little endian format. I end up with a one byte
long 'string' :-(

The solution, I think is to perhaps use:
GlobalSize(stgMedium.hGlobal);
which instead of strlen, to get the actual size of memory
allocated by the drop source.

In the meantime I'm changing our data to be null
terminated.

Discussion

  • Alan Parker

    Alan Parker - 2002-07-24
    • priority: 5 --> 7
     
  • Alan Parker

    Alan Parker - 2002-07-25
    • priority: 7 --> 8
     
  • Georgios Petasis

    Logged In: YES
    user_id=92283

    Yes, it is true that data is assumed to be NULL terminated.
    However the solution seems more logical.
    The only problem is that I don't know
    windows enough to know that I can request the size.
    It will be fixed as soon as possible :-)

     
  • Georgios Petasis

    • labels: 104387 -->
    • priority: 8 --> 9
     

Log in to post a comment.

MongoDB Logo MongoDB