目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1336

100%

CWE-135 多字节字符串长度的计算不正确 类漏洞列表 1

CWE-135 多字节字符串长度的计算不正确 类弱点 1 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-135属于字符串处理缺陷,指程序未能正确计算包含宽字符或多字节字符的字符串长度。攻击者常利用此漏洞导致缓冲区溢出或逻辑错误,从而引发内存破坏或拒绝服务。开发者应避免使用仅计算字节的函数,转而采用支持多字节编码的安全API,确保在分配内存或进行边界检查时准确识别字符实际占用空间,从而从根本上消除此类风险。

MITRE CWE 官方描述
CWE:CWE-135 多字节字符串长度计算错误 英文:产品未能正确计算可能包含宽字符或多字节字符的字符串的长度。
常见影响 (3)
Integrity, Confidentiality, AvailabilityExecute Unauthorized Code or Commands
This weakness may lead to a buffer overflow. Buffer overflows often can be used to execute arbitrary code, which is usually outside the scope of a program's implicit security policy. This can often be used to subvert any other security service.
Availability, ConfidentialityRead Memory, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory)
Out of bounds memory access will very likely result in the corruption of relevant memory, and perhaps instructions, possibly leading to a crash. Other attacks leading to lack of availability are possible, including putting the program into an infinite loop.
ConfidentialityRead Memory
In the case of an out-of-bounds read, the attacker may have access to sensitive information. If the sensitive information contains system details, such as the current buffer's position in memory, this knowledge can be used to craft further attacks, possibly with more severe consequences.
缓解措施 (2)
ImplementationAlways verify the length of the string unit character.
ImplementationUse length computing functions (e.g. strlen, wcslen, etc.) appropriately with their equivalent type (e.g.: byte, wchar_t, etc.)
代码示例 (1)
The following example would be exploitable if any of the commented incorrect malloc calls were used.
#include <stdio.h> #include <strings.h> #include <wchar.h> int main() { wchar_t wideString[] = L"The spazzy orange tiger jumped " \ "over the tawny jaguar."; wchar_t *newString; printf("Strlen() output: %d\nWcslen() output: %d\n", strlen(wideString), wcslen(wideString)); /* Wrong because the number of chars in a string isn't related to its length in bytes // newString = (wchar_t *) malloc(strlen(wideString)); */ /* Wrong because wide characters aren't 1 byte long! // newString = (wchar_t *) malloc(wcslen(wideString)); */ /* Wrong because wcslen does not include the terminating null */ newStrin
Bad · C
Strlen() output: 0 Wcslen() output: 53
Result
CVE ID标题CVSS风险等级Published
CVE-2026-0810 gitoxide 安全漏洞 — gitoxide 7.1 High2026-01-26

CWE-135(多字节字符串长度的计算不正确) 是常见的弱点类别,本平台收录该类弱点关联的 1 条 CVE 漏洞。