Skip to content

Commit 075dac5

Browse files
committed
last commit. tested and stack_guard change fucntion works
1 parent 27c121c commit 075dac5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

obc/app/modules/state_mgr/state_mgr.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ obc_error_code_t sendToStateMgrEventQueue(state_mgr_event_t *event) {
6767

6868
static void sendStartupMessages(void) {}
6969

70-
static inline void __attribute__((no_stack_protector)) construct_stk_chk_guard() {
71-
if (__stack_chk_guard == (void *)0xDEADBEEF) {
72-
__stack_chk_guard = (void *)stack_chk_guard_change();
73-
}
74-
}
75-
7670
uint32_t stack_chk_guard_change(void) {
7771
obc_error_code_t errCode;
7872
uint32_t newStackGuard = 0;
@@ -81,14 +75,19 @@ uint32_t stack_chk_guard_change(void) {
8175
LOG_IF_ERROR_CODE(cc1120Rng(&randomByte));
8276
if (errCode == OBC_ERR_CODE_SUCCESS) {
8377
(newStackGuard) = (newStackGuard << 8) | randomByte;
84-
8578
} else {
8679
return 0xDEADBEEF;
8780
}
8881
}
8982
return newStackGuard;
9083
}
9184

85+
static inline void __attribute__((no_stack_protector)) construct_stk_chk_guard() {
86+
if (__stack_chk_guard == (void *)0xDEADBEEF) {
87+
__stack_chk_guard = (void *)stack_chk_guard_change();
88+
}
89+
}
90+
9291
void obcTaskFunctionStateMgr(void *pvParameters) {
9392
obc_error_code_t errCode;
9493

0 commit comments

Comments
 (0)