Question: Here is an excerpt of the CERT coding standards regarding operations on unsigned integers ( Rule INT 3 C ) : A computation involving unsigned
Here is an excerpt of the CERT coding standards regarding operations on unsigned integers Rule INTC :
A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type
According to the CERT, this wraparound behavior should be avoided in the following situations: integer operand on any pointer arithmetic, including array indexing assignment expressions for the declaration of a variable length array Give some security critical examples for each of these situations
Here is code fragment extracted from OpenSSH :
unsigned int i nrep; user inputs
nrep packetgetint ;
response mallocnrepsizeofchar;
if response NULL
for i; i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
