SNMP accepts malformed remote ports
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 半天
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- networking
调研方向
该 issue 指向 SNMP 构造函数中对主机和端口的解析,报告称其使用了 atoi()。负载中没有指明文件,因此请先在 SNMP 扩展源码中定位该解析逻辑。使用报告中的两次构造函数调用进行复现,然后检查格式错误的端口是否抛出 ValueError,同时 0 和 65535 仍然可用。当两种错误情况都抛出异常,并且 SNMP 扩展 tests 目录下的 phpt 测试覆盖了这两种情况时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Description
The following code:
<?php
new SNMP(SNMP::VERSION_1, '127.0.0.1:not-a-port', 'public');
new SNMP(SNMP::VERSION_1, '127.0.0.1:123junk', 'public');
does not throw an exception. The first port is interpreted as 0, and the
second is interpreted as 123.
I expected both malformed ports to result in a ValueError. The parser should
require at least one decimal digit, reject trailing characters, and enforce the
existing 0..65535 range.
PHP Version
PHP 8.4.28-dev (cli) (built: Nov 1 2026 11:27:04) (ZTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.4.28-dev, Copyright (c) Zend Technologies
The same permissive atoi() parsing is present on the current master branch.
Operating System
macOS 27.2 arm64
- 主要语言
- C
- 星标
- 41.7k
- 派生
- 8.5k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 144
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
master: part of the mbstring bailout fix got lost in a merge可能已有人在做 @lazerg 于 11 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
quoted_printable_encode() produces lines longer than 76 characters for bytes 0xF5 to 0xFF可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
Feature Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
相似的 Issue
-
luaebpf: the by-example page's intro names two outcomes of a lowering and omits the stop with the default verdict可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭documentation severity: low
难度 1/5 1 小时以内 新手友好度 88/100
luainkernel/lunatik#2231 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
Revivedx/SavageWindRecomp#402 ·
维护者通常 1 天内回复
-
cleanup help wanted
难度 2/5 1-3 小时 新手友好度 62/100
ESPresense/ESPresense#2602 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
apache/arrow-swift#209 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
libretiny-eu/libretiny#435 ·
维护者通常 4 天内回复