The product receives input that is expected to specify an index, position, or offset into an indexable resource such as a buffer or file, but it does not validate or incorrectly validates that the specified index/position/offset has the required properties.
Often, indexable resources such as memory buffers or files can be accessed using a specific position, index, or offset, such as an index for an array or a position for a file. When untrusted input is not properly validated before it is used as an index, attackers could access (or attempt to access) unauthorized portions of these resources. This could be used to cause buffer overflows, excessive resource allocation, or trigger unexpected failures.
Impact: Varies by Context
Strategy: Input Validation
Effectiveness: High
/* capture the sizes of all messages / int getsizes(int sock, int count, int *sizes) { ``` ... char buf[BUFFER_SIZE]; int ok; int num, size;
c
// 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;
c
// 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
c// Method called from servlet to obtain product information* public String displayProductSummary(int index) {
java
// Method called from servlet to obtain product information* public String displayProductSummary(int index) {
java
javac