1. Vulnerability Description
- If you assign a bool type variable value to a pointer variable, a crash may occur.
2. Vulnerability Countermeasure
- Do not assign a bool type variable value to a pointer variable
3. Sample Code
- Vulnerable Code
void f(void) {
bool bTmp = false;
char *ptr = (char*)bTmp;
/* ... */
}
- Safe Code
#include <stdint.h>
void f(void) {
char *ptr = NULL;
/* ... */
uintptr_t number = (uintptr_t)ptr;
/* ... */
}