SSLContext#min_version= and #max_version= silently accept prefix strings and empty strings
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Issue 指向 ext/openssl/ossl_ssl.c 中的 parse_proto_version(),并展示了当前的比较方式和建议的长度检查。阅读该函数,并找到 SSLContext#min_version= 和 #max_version= 的测试。补充对空字符串、前缀和嵌入 NUL 字节的测试,并确认它们会引发 ArgumentError,而完整的版本名称仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
Description
parse_proto_version() in ext/openssl/ossl_ssl.c compares the input protocol version name using strncmp(map[i].name, RSTRING_PTR(str), RSTRING_LEN(str)) without verifying that the string lengths match.
// ext/openssl/ossl_ssl.c:879-882
for (i = 0; i < numberof(map); i++)
if (!strncmp(map[i].name, RSTRING_PTR(str), RSTRING_LEN(str)))
return map[i].version;
rb_raise(rb_eArgError, "unrecognized version %+"PRIsVALUE, str);
Actual Behavior
Because only RSTRING_LEN(str) bytes are compared:
""(empty string),"S", or"SSL"silently matches"SSL2"(SSL2_VERSION)"T","TLS", or:TLSsilently matches"TLS1"(TLS1_VERSION)- Strings with embedded NUL bytes (e.g.,
"TLS1\0_3") silently match"TLS1"(TLS1_VERSION)
Expected Behavior
Empty strings, partial prefixes, and strings containing embedded NUL bytes should raise ArgumentError (unrecognized version).
Suggested Fix
Verify that the string lengths are equal and compare using memcmp():
for (i = 0; i < numberof(map); i++)
if ((size_t)RSTRING_LEN(str) == strlen(map[i].name) &&
memcmp(map[i].name, RSTRING_PTR(str), RSTRING_LEN(str)) == 0)
return map[i].version;
(Discussed with @rhenium on [email protected] and agreed to track here as a regular bug.)
- 主要语言
- C
- 星标
- 276
- 派生
- 205
- 平均合并
- 21 小时 17 分钟
- 30 天内合并 PR
- 17
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby/openssl 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
Add OpenSSL::SSL::SSLContext#client_hello_cb= (binding for SSL_CTX_set_client_hello_cb())可能已有人在做 @kou 于 37 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 53/100
维护者通常 1 天内回复
-
Documenting how to use OpenSSL::SSL::SSLContext in PQC use cases可能已有人在做 @junaruga 于 23 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
维护者通常 1 天内回复
-
Expose XOFs like SHAKE128 and SHAKE256可能已有人在做 @rhenium 于 133 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition root可能已有人在做 @tuhaihe 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apache/cloudberry#2356 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
-
难度 1/5 1-3 小时 新手友好度 78/100
crosspoint-reader/crosspoint-reader#4535 ·
维护者通常 1 天内回复
-
[core] Clients never advertise RNS_UD_CS_SUPPORT_ERRINFO_PDU, so a conforming server can't send them Set Error Info可能已有人在做 @akallabeth 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
FreeRDP/FreeRDP#14230 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
Genymobile/scrcpy#7178 ·
维护者通常 3 天内回复