2207
Relevant to the view "Weaknesses for Simplified Mapping of Published
Vulnerabilities" (CWE-1003)
Nature Type ID Name Page
ChildOf 834 Excessive Iteration 1754
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 438 Behavioral Problems 2326
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Availability DoS: Resource Consumption (CPU)
DoS: Resource Consumption (Memory)
DoS: Amplification
An infinite loop will cause unexpected consumption of
resources, such as CPU cycles or memory. The software's
operation may slow down, or cause a long time to respond.
Demonstrative Examples
Example 1:
In the following code the method processMessagesFromServer attempts to establish a connection
to a server and read and process messages from the server. The method uses a do/while loop to
continue trying to establish the connection to the server when an attempt fails.
Example Language: C (Bad)
int processMessagesFromServer(char *hostaddr, int port) {
...
int servsock;
int connected;
struct sockaddr_in servaddr;
// create socket to connect to server
servsock = socket( AF_INET, SOCK_STREAM, 0);
memset( &servaddr, 0, sizeof(servaddr));
CWE Version 4.14
CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')