Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It occurs Global memory Buffer Overrun #140

Open
nsicko42 opened this issue Nov 9, 2023 · 0 comments
Open

It occurs Global memory Buffer Overrun #140

nsicko42 opened this issue Nov 9, 2023 · 0 comments

Comments

@nsicko42
Copy link

nsicko42 commented Nov 9, 2023

in socket() function.

CHECK_SOCKNUM() Macro try to checks that socket number is no more 4 like a below.

#define CHECK_SOCKNUM()   \
    do{                    \
        if(sn > _WIZCHIP_SOCK_NUM_) return SOCKERR_SOCKNUM;   \
    }while(0);             \

but sn > _WIZCHIP_SOCK_NUM_ means that socket number is not more than 4. it means that is effective 0, 1, 2, 3 and 4.

This code occurs global memory buffer overrun by sock_pack_info[sn] = 0;.
Because size of sock_pack_info is 4.
What happens memory access by sock_pack_info[4]?

If I correct, you should be like this.

#define CHECK_SOCKNUM()   \
    do{                    \
        if(sn >= _WIZCHIP_SOCK_NUM_) return SOCKERR_SOCKNUM;   \
    }while(0);             \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant