36 vulnerabilities classified as CWE-805 (使用不正确的长度值访问缓冲区). AI Chinese analysis included.
CWE-805 represents a critical memory safety weakness where software performs sequential read or write operations using an incorrect length value, leading to access beyond the allocated buffer boundaries. This flaw typically manifests when developers miscalculate the size of the destination buffer or fail to validate input lengths against available space, resulting in buffer overflows. Attackers exploit this vulnerability by supplying crafted inputs that exceed expected limits, allowing them to overwrite adjacent memory, corrupt data structures, or execute arbitrary code with elevated privileges. To prevent such incidents, developers must rigorously validate all length parameters before performing memory operations, ensuring they strictly adhere to the actual allocated size. Implementing bounds-checking mechanisms, utilizing safe string handling libraries, and conducting thorough code reviews are essential practices to mitigate the risk of out-of-bounds memory access and maintain application integrity.
void host_lookup(char *user_supplied_addr){ struct hostent *hp; in_addr_t *addr; char hostname[64]; in_addr_t inet_addr(const char *cp); /*routine that ensures user_supplied_addr is in the right format for conversion */ validate_addr_form(user_supplied_addr); addr = inet_addr(user_supplied_addr); hp = gethostbyaddr( addr, sizeof(struct in_addr), AF_INET); strcpy(hostname, hp->h_name); }int returnChunkSize(void *) { /* if chunk info is valid, return the size of usable memory, * else, return -1 to indicate an error */ ... } int main() { ... memcpy(destBuf, srcBuf, (returnChunkSize(destBuf)-1)); ... }Vulnerabilities classified as CWE-805 (使用不正确的长度值访问缓冲区) represent 36 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.