Weaknesses of type CWE-131

190 results

Cálculo incorreto do tamanho de buffer

O desenvolvedor calcula errado quantos bytes um buffer precisa armazenar, geralmente por erro de lógica matemática, confundindo unidades (bytes vs. elementos) ou não contando caracteres especiais como nulo terminador. Isso abre espaço para estouro de buffer quando dados maiores que o esperado são copiados para esse espaço insuficiente.

Example

Um programa aloca espaço para uma string com `malloc(strlen(entrada))` esquecendo o byte do nulo terminador; quando copia a string com `strcpy()`, escreve além dos limites alocados. Ou calcula `tamanho = num_elementos * 4` quando deveria ser `num_elementos * sizeof(tipo)`.

How to mitigate

Use funções seguras como `snprintf()` ou `strncpy()` que respeitam limites; valide o tamanho final antes de alocar memória; prefira bibliotecas de string seguras; implemente testes unitários que cubram casos-limite (strings vazias, máximo esperado, acima do máximo).

CVE-2022-39377HIGHsysstat Incorrect Buffer Size calculation on 32-bit systems results in RCE via buffer overflowEPSS 1.4%CVE-2019-19282HIGHA vulnerability has been identified in OpenPCS 7 V8.1 (All versions), OpenPCS 7 V8.2 (All versions), OpenPCS 7 V9.0 (All versions < V9.0 UpdEPSS 1.3%CVE-2022-31630MEDIUMOOB read due to insufficient input validation in imageloadfont()EPSS 1.3%CVE-2020-1680MEDIUMJunos OS: MX Series: MS-MPC/MIC might crash when processing malformed IPv6 packet in NAT64 configuration.EPSS 1.3%CVE-2021-21782CRITICALAn out-of-bounds write vulnerability exists in the SGI format buffer size processing functionality of Accusoft ImageGear 19.8. A specially cEPSS 1.3%CVE-2021-38423MEDIUMGurumDDS Heap-based Incorrect Calculation of Buffer SizeEPSS 1.3%CVE-2022-2520—A flaw was found in libtiff 4.4.0rc1. There is a sysmalloc assertion fail in rotateImage() at tiffcrop.c:8621 that can cause program crash wEPSS 1.3%CVE-2023-0568HIGHArray overrun in common path resolve codeEPSS 1.2%CVE-2021-21824HIGHAn out-of-bounds write vulnerability exists in the JPG Handle_JPEG420 functionality of Accusoft ImageGear 19.9. A specially crafted malformeEPSS 1.2%CVE-2022-22137CRITICALA memory corruption vulnerability exists in the ioca_mys_rgb_allocate functionality of Accusoft ImageGear 19.10. A specially-crafted malformEPSS 1.1%CVE-2021-21793CRITICALAn out-of-bounds write vulnerability exists in the JPG sof_nb_comp header processing functionality of Accusoft ImageGear 19.8 and 19.9. A spEPSS 1.1%CVE-2023-5941—libc stdio buffer overflowEPSS 1.1%CVE-2026-78002HIGHRsyslog: rsyslog: denial of service via heap buffer overflow in rainerscript replace() functionEPSS 1.1%CVE-2023-4257HIGHUnchecked user input length in the Zephyr WiFi shell moduleEPSS 1.1%CVE-2023-30575MEDIUMApache Guacamole: Incorrect calculation of Guacamole protocol element lengthsEPSS 1.0%CVE-2023-24819CRITICALRIOT-OS vulnerable to Buffer Overflow during IPHC receiveEPSS 1.0%CVE-2025-1861MEDIUMStream HTTP wrapper truncates redirect location to 1024 bytesEPSS 0.9%CVE-2026-42944HIGHHeap overflow with multiple NSID, COOKIE, PADDING EDNS optionsEPSS 0.8%CVE-2026-69598HIGHWindows iSCSI Remote Code Execution VulnerabilityEPSS 0.8%CVE-2023-50736CRITICALA vulnerability has been identified in the PostScript interpreter in various Lexmark devices.EPSS 0.8%