viewing paste Unknown #47076 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include <winsock.h>
 
int global_var = 0; // some global var @ BBEED0
 
int recv_process()
{
    int first_var = global_var;
    int encrypted_var = first_var ^ 0xf; // 0xf since we don't know what frame address is.
    fd_set readfd;
    timeval timeout = 0;
    int socket_fd = 0, recv_ret;
    SOCKET s;
    char buf[800];
 
    socket_fd = select(0, &readfd, NULL, NULL, *timeout));
 
    if (socket_fd <= 0) {
        integrityCheck(encrypted_var);
        return 1;
    }
 
    recv_ret = recv(s, &buf, 800, 0);
 
    if (recv_ret == -1) {
        int error_code = WSAGetLastError();
 
        if (error_code == WSAEWOULDBLOCK || error_code == WSAENOTCONN) {
            integrityCheck(encrypted_var);
            return 1; // after integrity
        }
    } else if (recv_ret > 0) {
        copy_func(sizeof(buf), &buf);
 
        integrityCheck(encrypted_var);
        return 0;
    }
 
    if (socket_fd == -1) {
        integrityCheck(encrypted_var);
        return 0;
    }
 
    closesocket(socket_fd);
 
    somefunc(); //....
}
 
void integrityCheck(int encrypted_var)
{
    if (encrypted_var != global_var) {
        if (isProcessorFeaturePresent(17) == 0) {
            //....
        } else {
            // exit(29) ??
        }
    }
}
Viewed 1050 times, submitted by Guest.