41 vulnerabilities classified as CWE-1285. AI Chinese analysis included.
CWE-1285 represents a critical input validation weakness where software fails to properly verify that a user-supplied index, position, or offset falls within the acceptable bounds of an indexable resource, such as a memory buffer or file. Attackers typically exploit this flaw by providing maliciously crafted values that exceed the resource’s limits, leading to out-of-bounds reads or writes. These exploits can result in data corruption, application crashes, or the execution of arbitrary code by accessing unauthorized memory regions. To prevent such vulnerabilities, developers must implement rigorous input validation checks that explicitly verify the provided index against the minimum and maximum allowable values before any access operation occurs. Additionally, utilizing safe programming languages with automatic bounds checking or employing static analysis tools during the development lifecycle can help identify and mitigate these risky coding patterns before deployment.
/* capture the sizes of all messages */ int getsizes(int sock, int count, int *sizes) { ... char buf[BUFFER_SIZE]; int ok; int num, size; // read values from socket and added to sizes array while ((ok = gen_recv(sock, buf, sizeof(buf))) == 0) { // continue read from socket until buf only contains '.' if (DOTLINE(buf)) break; else if (sscanf(buf, "%d %d", &num, &size) == 2) sizes[num - 1] = size; } ... }/* capture the sizes of all messages */ int getsizes(int sock, int count, int *sizes) { ... char buf[BUFFER_SIZE]; int ok; int num, size; // read values from socket and added to sizes array while ((ok = gen_recv(sock, buf, sizeof(buf))) == 0) { // continue read from socket until buf only contains '.' if (DOTLINE(buf)) break; else if (sscanf(buf, "%d %d", &num, &size) == 2) { if (num > 0 && num <= (unsigned)count) sizes[num - 1] = size; else /* warn about possible attempt to induce buffer overflow */ report(stderr, "Warning: ignoring bogus data for message sizes returned by server.\n"); } } ...// Method called from servlet to obtain product information public String displayProductSummary(int index) { String productSummary = new String(""); try { String productSummary = getProductSummary(index); } catch (Exception ex) {...} return productSummary; } public String getProductSummary(int index) { return products[index]; }// Method called from servlet to obtain product information public String displayProductSummary(int index) { String productSummary = new String(""); try { String productSummary = getProductSummary(index); } catch (Exception ex) {...} return productSummary; } public String getProductSummary(int index) { String productSummary = ""; if ((index >= 0) && (index < MAX_PRODUCTS)) { productSummary = products[index]; } else { System.err.println("index is out of bounds"); throw new IndexOutOfBoundsException(); } return productSummary; }Vulnerabilities classified as CWE-1285 represent 41 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.