kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

stack_runtime.c (365B)


      1 void stack_smash_guard(void);
      2 
      3 static int protected_return(int path) {
      4   if (path == 2) {
      5     stack_smash_guard();
      6     return 0;
      7   }
      8   volatile char buffer[8];
      9   buffer[0] = 1;
     10   stack_smash_guard();
     11   if (path) return buffer[0] - 1;
     12   return buffer[0] - 1;
     13 }
     14 
     15 #ifndef STACK_PATH
     16 #define STACK_PATH 0
     17 #endif
     18 
     19 int main(void) { return protected_return(STACK_PATH); }