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

net.h--addSize 存在内存越界访问的情况 #68

Closed
liaodong opened this issue Aug 6, 2019 · 5 comments
Closed

net.h--addSize 存在内存越界访问的情况 #68

liaodong opened this issue Aug 6, 2019 · 5 comments

Comments

@liaodong
Copy link

liaodong commented Aug 6, 2019

addSize不做越界检查,可能会存在buffer空间不够的情况越界访问吧。

如果空间超过exp_, 应该做相应的处理。

@yedf2
Copy link
Owner

yedf2 commented Aug 7, 2019

一般情况下使用:
buf.append(data)

有时为了避免数据拷贝,会采用下面这种用法
char * p = buf.makeRoom(2048)
// copy n bytes data
buf.addSize(n)

只有在很关注性能时,才会使用addSize时,因此实现时,不应做过多的检查与操作,避免影响性能

@liaodong
Copy link
Author

liaodong commented Aug 7, 2019

我在用httpserver,发现同一个TCP连接中,如果客户端发送多条数据,会造成 httpserver的buffer的越界。猜测可能是addSize造成的。void TcpConn::handleRead(const TcpConnPtr& con) 中的 addSize

@yedf2
Copy link
Owner

yedf2 commented Aug 8, 2019

您好,目前这个httpserver只是具备的最简单的功能,对于您这边的发送多条数据这类高级一些的用法,我们还不支持

@jievince
Copy link

@yedf2 你好, 请问基于handy库和RFC2616(http协议)实现一个完整的http服务器在技术上可行的吗?

@yedf2
Copy link
Owner

yedf2 commented Dec 16, 2019

您好,现有的nginx能够满足绝大部分需求,因此我们没有打算基于handy再实现一个

@yedf2 yedf2 closed this as completed Jun 18, 2021
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

3 participants