viewing paste Unknown #47048 | 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
#include <winsock.h>
 
int global_var = 0; // some global var @ BBEED0
 
int recv_process()
{
    int first_var = global_var;
    int stack_crypt = 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)
        return 1;
 
    recv_ret = recv(s, &buf, 800, 0);
 
    if (recv_ret == -1) {
        int error_code = WSAGetLastError();
 
        if (error_code == WSAEWOULDBLOCK || error_code == WSAENOTCONN)
            return 1; // after integrity
    } else if (recv_ret <= 0) {
        if (socket_fd == -1) {
            return 0
        }
 
        closesocket(socket_fd);
 
        somefunc(); //....
    }
 
 
 
}
Viewed 942 times, submitted by Guest.