Versions Compared

Key

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

...

Code Block
bgColor#ccccff
langc
#include <string.h>
 
struct foo_header {
  int len;
  /* ... */
};
  
void func(char *data, size_t offset) {
  struct foo_header header; 
  memcpy(&header, data + offset, sizeof(header));

  /* ... */
}

Exceptions

 

EXP36-EX0: Some platforms, notably x86, have relaxed requirements with regard to pointer alignment. Using a pointer that is not properly aligned is correctly handled by the platform, although the platform may impose a performance penalty. On such a platform, improper pointer alignment is permitted, as it is an efficiency problem but not a security problem.

...