Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1114343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:59:33+00:00 2026-05-17T02:59:33+00:00

I am interposing the memcpy() function in C because the target application uses it

  • 0

I am interposing the memcpy() function in C because the target application uses it to concatenate strings and I want to find out which strings are being created. The code is:

void * my_memcpy ( void * destination, const void * source, size_t num )
{
    void *ret = memcpy(destination, source, num);
    // printf ("[MEMCPY] = %s \n", ret);
    return ret;
}

The function gets called succesfully but the first parameter can be whatever and I only want to trace it if the result is a string or array. I would have to ask if it is array or string. I know this can’t be done straightforward: is there anyway to find out what RET points to?

I am working under MACOSX and interpositioning with DYLD.

Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:59:33+00:00Added an answer on May 17, 2026 at 2:59 am

    As void* represents a raw block of memory, there is no way to determine what actual data lies there.

    However, you can make a “string-like” memory dump on every operation, just give the resulting output some sort of the “upper output limit”.

    This could be implemented the following way:

    const size_t kUpperLimit = 32;
    
    void output_memory_dump(void* memory) {
       std::cout.write(reinterpret_cast<char*>(memory), kUpperLimit);
    }
    

    For non-string like data the output would be hardly interpretable, but otherwise you’d get what you were searching for.

    You could attempt to apply some guess-based approach like iterating through reinterpret_cast<void*>(memory) and making is_alphanumeric && is_space checks to every symbol, but this approach doesn’t seem very stable (who knows what could actually lie in that void*…).

    Anyway, for some situations that might be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a challenge question / problem. Hope you find it interesing. Scenario: You
So, I'm messing around with some interposing code on OSX (gcc 4.2.1) and I'm
I wrote a web service that respond JSON content lower than 1K. Which one
My problem: JavaScript calls into the plugin, which forks a thread that opens a
I have some legacy application in vb6 and I am interoping into .net It
Am interoping a c++ dll and am attempting to access it's functions. Below is
I'd like to interpose between class methods to dynamically extends an object. I already
My main question is to calculate the last alert message, but any other information
I’m using Drupal (please note that this is not a Drupal related question), and
I have a small question about structures with the LayoutKind.Explicit attribute set. I declared

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.