Skip to content

Commit 049c205

Browse files
committed
fix incorrect address being printed in fastbin_dup_into_stack
note that the assert at the end of the file is correct so this is really just an issue with the address that is printed i've also increased the size of stack_var to match what is logically being used note that a patch was made in 0a3ba05 fixing this issue however the patch only fixed the issue for glibc_2.35 when it should have been applied to versions 2.33 -> 2.39
1 parent d9c79f5 commit 049c205

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

glibc_2.33/fastbin_dup_into_stack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int main()
2020
}
2121

2222

23-
unsigned long stack_var[2] __attribute__ ((aligned (0x10)));
23+
unsigned long stack_var[4] __attribute__ ((aligned (0x10)));
2424

25-
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var);
25+
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var + 2);
2626

2727
fprintf(stderr, "Allocating 3 buffers.\n");
2828
int *a = calloc(1,8);

glibc_2.34/fastbin_dup_into_stack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int main()
2020
}
2121

2222

23-
unsigned long stack_var[2] __attribute__ ((aligned (0x10)));
23+
unsigned long stack_var[4] __attribute__ ((aligned (0x10)));
2424

25-
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var);
25+
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var + 2);
2626

2727
fprintf(stderr, "Allocating 3 buffers.\n");
2828
int *a = calloc(1,8);

glibc_2.36/fastbin_dup_into_stack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int main()
2020
}
2121

2222

23-
unsigned long stack_var[2] __attribute__ ((aligned (0x10)));
23+
unsigned long stack_var[4] __attribute__ ((aligned (0x10)));
2424

25-
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var);
25+
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var + 2);
2626

2727
fprintf(stderr, "Allocating 3 buffers.\n");
2828
int *a = calloc(1,8);

glibc_2.37/fastbin_dup_into_stack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int main()
2020
}
2121

2222

23-
unsigned long stack_var[2] __attribute__ ((aligned (0x10)));
23+
unsigned long stack_var[4] __attribute__ ((aligned (0x10)));
2424

25-
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var);
25+
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var + 2);
2626

2727
fprintf(stderr, "Allocating 3 buffers.\n");
2828
int *a = calloc(1,8);

glibc_2.38/fastbin_dup_into_stack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int main()
2020
}
2121

2222

23-
unsigned long stack_var[2] __attribute__ ((aligned (0x10)));
23+
unsigned long stack_var[4] __attribute__ ((aligned (0x10)));
2424

25-
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var);
25+
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var + 2);
2626

2727
fprintf(stderr, "Allocating 3 buffers.\n");
2828
int *a = calloc(1,8);

glibc_2.39/fastbin_dup_into_stack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int main()
2020
}
2121

2222

23-
unsigned long stack_var[2] __attribute__ ((aligned (0x10)));
23+
unsigned long stack_var[4] __attribute__ ((aligned (0x10)));
2424

25-
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var);
25+
fprintf(stderr, "The address we want calloc() to return is %p.\n", stack_var + 2);
2626

2727
fprintf(stderr, "Allocating 3 buffers.\n");
2828
int *a = calloc(1,8);

0 commit comments

Comments
 (0)