Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this noncompliant code example, an array of long is allocated and assigned to pThis example also checks for unsigned integer overflow in compliance with INT32-C. Ensure that operations on signed integers do not result in overflowThe code also ensures that len is not equal to zero. (See MEM04-C. Do not perform Beware of zero-length allocations.) However, sizeof(int) is used to size the allocated memory. If sizeof(long) is larger than sizeof(int), then an insufficient amount of memory is allocated.

...

...