EldoS | Feel safer!

Software components for data protection, secure storage and transfer

IOS eventCallback

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
Posted: 05/09/2012 01:30:26
by zheng kai (Basic support level)
Joined: 04/18/2012
Posts: 2

I have some trouble in "MsgConnect evaluation,C++ package for IOS".
if i use code :

void eventCallback(void* resv, void* sender, MCMessage& message, bool& handled)
    NSString *str = @"1231...1111";
    NSLog(@"length str%d",[str length]);
    const char *cCallBack = [str UTF8String];
    int nCallBack = strlen(cCallBack);
    memcpy(message.Data, cCallBack, nCallBack+1);
    message.DataSize = nCallBack+1;
    handled = true;    

The programe crashed.
detail in sales@eldos.com
Posted: 05/09/2012 01:53:34
by Eugene Mayevski (EldoS Corp.)

Please read the support policy before requesting assistance.

1) We don't provide support to users from China who don't have a license.
2) sales e-mail is not used for support. Your e-mail if you sent it went to spam anyway.

I am replying here just because other users might be interested in the problem.

In your code you don't allocate memory and copy the data into message.Data which doesn't reference a valid buffer.

Sincerely yours
Eugene Mayevski
Posted: 05/09/2012 03:17:21
by zheng kai (Basic support level)
Joined: 04/18/2012
Posts: 2

1. I have the license, but IOS product does not support it.
2.i have code:
    unsigned int size = nCallBack+1;
    printf("*********** data ***********\n");
    char *c;
    int counter=0;
    int i;
    for (i=2; i<size+2; i++) {
        c = (char *)message.Data+i;
        if ( *c != ' ' ) {
            printf("%c", *c);
        else {
            printf("NULL ");

It works fine.
2. If the feedback string length within 20 chars, it works fine.
Posted: 05/09/2012 03:45:03
by Eugene Mayevski (EldoS Corp.)

If you have a license, please assign the license ticket to your user account before we continue. The ticket itself and the procedure of it's use are specified in the registration e-mail that was sent to you upon license purchase.

Sincerely yours
Eugene Mayevski
Posted: 05/09/2012 03:48:29
by Eugene Mayevski (EldoS Corp.)

When you send some data, Message.Data will have a reference to received data block. The buffer size will be equal to the size of data. Consequently if you put larger piece of data to that block, you will corrupt the memory that follows the allocated block. This is why your application crashes.

On a side note please use "code" markup (see the CODE button above the message edit field) to mark your code and make it more readable. I've done this for you manually in above messages.

Sincerely yours
Eugene Mayevski
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.



Topic viewed 3636 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!