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

Enforce payload size limit on sent message #114

Closed
gdnathan opened this issue Sep 22, 2024 · 6 comments · Fixed by #132
Closed

Enforce payload size limit on sent message #114

gdnathan opened this issue Sep 22, 2024 · 6 comments · Fixed by #132
Assignees

Comments

@gdnathan
Copy link
Contributor

Following up discussion on #112 .

"To actually enforce the limit, we could do something like this maybe:
src/network/wire/lib.zig

const MAX_PAYLOAD_SIZE: u32 = 32 * 1024 * 1024

const payload_len: u32 = @intCast(payload.len);
if (payload_len > MAX_PAYLOAD_SIZE) {
    return someerror
}

"

@supreme2580
Copy link
Contributor

@gdnathan can I be assigned to this?

Copy link

onlydustapp bot commented Sep 26, 2024

Hey @supreme2580!
Thanks for showing interest.
We've created an application for you to contribute to btczee.
Go check it out on OnlyDust!

@supreme2580
Copy link
Contributor

supreme2580 commented Sep 26, 2024

@gdnathan I was reading through src/network/wire/lib.zig sendMessage function and I saw
const MAX_SIZE: usize = 0x02000000;
which is
const MAX_PAYLOAD_SIZE: u32 = 32 * 1024 * 1024
and in sendMessage I saw

if (total_message_size > MAX_SIZE) {
        return Error.MessageTooLarge;
} 

is it not the same as limiting size on the sent message?

@tdelabro
Copy link
Collaborator

yes it is. It looks like it is missing from receiveMessage tho. You can add it there too

@supreme2580
Copy link
Contributor

Okay great, @tdelabro @gdnathan can I be assigned to this?

@gdnathan
Copy link
Contributor Author

Hey @supreme2580 just fyi, I'm just a contributor on this project haha not a maintainer, so I cannot assign you to any tasks !

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

Successfully merging a pull request may close this issue.

3 participants