12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include "string.h"
- #include "private.h"
- #include "context.h"
- static bool_t tainted = BOOL_FALSE;
- bool_t lub_heap_taint(bool_t enable)
- {
- bool_t result = tainted;
- tainted = enable;
- return result;
- }
- bool_t lub_heap_is_tainting(void)
- {
- return tainted;
- }
- void lub_heap_taint_memory(char *ptr, lub_heap_taint_t type, size_t size)
- {
- if (BOOL_TRUE == tainted) {
- #ifdef __vxworks
- extern function_t taskDestroy;
- extern function_t taskSuspend;
-
- if (LUB_HEAP_TAINT_FREE == type) {
- int i;
-
- stackframe_t frame;
- lub_heap__get_stackframe(&frame, 10);
- for (i = 0; i < 10; i++) {
- function_t *address = frame.backtrace[i];
- if ((address > &taskDestroy)
- && (address < &taskSuspend)) {
- return;
- }
- }
- }
- #endif
-
- memset(ptr, type, size);
- }
- }
|