brpc icon indicating copy to clipboard operation
brpc copied to clipboard

hostname2endpoint函数对域名提取可能不正确

Open liujianhua2016 opened this issue 3 years ago • 2 comments

Describe the bug (描述bug) 在butil/endpoint.cpp文件 hostname2endpoint函数中,对域名进行提取时,如果域名长度是恰好是63个字符时, 函数会进入这个if判断 if (i == sizeof(buf) - 1) { return -1; } 导致函数提前退出返回错误

To Reproduce (复现方法) 使用baidu_std协议通过域名方式访问server节点,如果域名长度恰好是63个字符时,会导致channel无法init成功

Expected behavior (期望行为) 域名长度不超过63,channel可以init成功

Versions (各种版本) OS: centos7.6 Compiler: gcc-4.8.5 brpc: master protobuf: baidu_std

Additional context/screenshots (更多上下文/截图)

liujianhua2016 avatar Aug 29 '22 03:08 liujianhua2016

@liujianhua2016 可以试下把buf的长度改大点,改成128试试呢?可以提个patch哈

lorinlee avatar Aug 29 '22 13:08 lorinlee

好的, 我稍后提个patch试试

liujianhua2016 avatar Aug 30 '22 09:08 liujianhua2016

fixed by #2179

chenBright avatar Sep 01 '23 03:09 chenBright