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 7979481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:47:31+00:00 2026-06-04T09:47:31+00:00

I detoured recv function, i trying to decrypt buffer, but decrypt function change buffer

  • 0

I detoured recv function, i trying to decrypt buffer, but decrypt function change buffer size, and i think decryotion is invalid, code:

int WINAPI OwnRecv(SOCKET s, char FAR *buff, int len, int flags)
{
    if(s == GameClientSocket)
    {
        int received = pTrampolineRecv(s, buff, len, flags);

        if(received <= 0)
        {
            return received;
        }
            // now strlen(buff) is 2!!
        char * plaintext;
        plaintext = (char *)aes_decrypt(&Decrypt_Context, (unsigned char*)buff, &received);
        (char *) buff = plaintext; // now strlen(buff) is 5!!
        return received;
    }
    return pTrampolineRecv(s, buff, len, flags);
}

What’s wrong with my code?

Thanks!

  • 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-06-04T09:47:33+00:00Added an answer on June 4, 2026 at 9:47 am

    You forgot to implement a protocol! Whatever protocol you use to encrypt and decrypt the data, you have to actually implement it. It has to define block sizes, padding, and so on. It won’t just work by magic. (Note that using a stream cipher will make this much easier than using a block cipher.)

    Also, don’t call strlen on arbitrary binary data! The strlen function is only for C-style strings.

    Also, this line of code doesn’t do what you think it does:

        (char *) buff = plaintext; // now strlen(buff) is 5!!
    

    Changing the value of buff, the variable that holds a pointer to the buffer, has no effect on the contents of the buffer. That’s all the caller cares about.

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

Sidebar

Related Questions

I'm trying to hot patch an exe in memory, the source is available but
In the past I have written C++ plugins that detoured the recvfrom() function in
What I am trying to do is use the Detours library to hook into
Here's the start of my program in Visual C++ 2010 Express: #pragma comment(lib, detoured.lib)
Using Windows Detours in C++, I've seen that it is possible to trampoline function
I tried searching the compiler errors on google, but it didn't even return a
I've been using R for a little over a year now and it's been
EDIT: I would like to thank you all for the swift replies ^^ Sleep()
So I've got an application that starts another application with my DLL injected (with
I have a collection of Points which represents a grid, I'm looking for an

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.