Skip to content

Commit

Permalink
first challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
javierprtd committed Oct 29, 2017
1 parent b6b5216 commit 579c04e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Binary file modified house of lore + unsafe unlink/heappyday
Binary file not shown.
7 changes: 4 additions & 3 deletions house of lore + unsafe unlink/heappyday.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>

#define MAX 100

// gcc heappyday.c -o heappyday

struct H {
void* m[MAX];
char* m[MAX];
unsigned size[MAX];
};

Expand Down Expand Up @@ -41,7 +42,7 @@ void crea() {
ptr.m[pos] = malloc(ptr.size[pos]);
puts("Enter the content: ");
int n = read(0, ptr.m[pos], ptr.size[pos]);
*(char **)&ptr.m[pos][n - 1] = '\0';
ptr.m[pos][n - 1] = '\0';
} else {
puts("Bad size.");
}
Expand All @@ -58,7 +59,7 @@ void modify() {
if (i < MAX) {
puts("Enter the content: ");
int n = read(0, ptr.m[i], ptr.size[i]);
*(char **)&ptr.m[i][n - 1] = '\0';
ptr.m[i][n - 1] = '\0';
} else {
puts("Bad position");
}
Expand Down
2 changes: 1 addition & 1 deletion house of lore + unsafe unlink/heappyday.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def salir():
victim->bk = buffer_2
'''

s = remote("172.17.4.8", 4242)
s = remote("localhost", 4444)
add(0, 256, "")
add(1, 256, "")
add(2, 256, "")
Expand Down

0 comments on commit 579c04e

Please sign in to comment.