1 From: Martin Willi <martin@revosec.ch>
2 Date: Fri, 3 May 2013 12:17:37 +0000 (+0200)
3 Subject: In memwipe_check(), don't put magic on stack when calling do_magic()
4 X-Git-Url: http://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=9312fbc7
6 In memwipe_check(), don't put magic on stack when calling do_magic()
8 Otherwise the magic might be on the stack while checking it.
11 --- a/src/libstrongswan/library.c
12 +++ b/src/libstrongswan/library.c
13 @@ -154,7 +154,7 @@ static bool equals(char *a, char *b)
14 * Write magic to memory, and try to clear it with memwipe()
16 __attribute__((noinline))
17 -static void do_magic(int magic, int **stack)
18 +static void do_magic(int *magic, int **stack)
22 @@ -162,7 +162,7 @@ static void do_magic(int magic, int **st
24 for (i = 0; i < countof(buf); i++)
29 /* passing buf to dbg should make sure the compiler can't optimize out buf.
30 * we use directly dbg(3), as DBG3() might be stripped with DEBUG_LEVEL. */
31 @@ -177,7 +177,7 @@ static bool check_memwipe()
33 int magic = 0xCAFEBABE, *ptr, *deeper, i, stackdir = 1;
35 - do_magic(magic, &deeper);
36 + do_magic(&magic, &deeper);