Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-21fa
project05b
Commits
05b12aff
Commit
05b12aff
authored
4 years ago
by
Caleb C. Sander
Browse files
Options
Download
Email Patches
Plain Diff
Add missing free()s
parent
a37ba771
master
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/stage3.h
+1
-6
include/stage3.h
src/index_guesser.c
+1
-0
src/index_guesser.c
src/recover_local_secret.c
+5
-9
src/recover_local_secret.c
with
7 additions
and
15 deletions
+7
-15
include/stage3.h
View file @
05b12aff
#include <inttypes.h>
const
char
SECRET
[]
=
"CLOCK"
;
#include <stdlib.h>
#include <string.h>
char
*
SECRET
=
"CLOCK"
;
static
inline
char
access_secret
(
size_t
i
)
{
static
inline
char
access_secret
(
size_t
i
)
{
return
SECRET
[
i
];
return
SECRET
[
i
];
...
...
This diff is collapsed.
Click to expand it.
src/index_guesser.c
View file @
05b12aff
...
@@ -34,4 +34,5 @@ int main() {
...
@@ -34,4 +34,5 @@ int main() {
if
(
guess
>
0
)
{
if
(
guess
>
0
)
{
printf
(
"%zu
\n
"
,
guess
);
printf
(
"%zu
\n
"
,
guess
);
}
}
free
(
pages
);
}
}
This diff is collapsed.
Click to expand it.
src/recover_local_secret.c
View file @
05b12aff
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "util.h"
#include "stage3.h"
#include "stage3.h"
const
uint64
_t
MIN_CHOICE
=
'A'
-
1
;
const
size
_t
MIN_CHOICE
=
'A'
-
1
;
const
uint64
_t
MAX_CHOICE
=
'Z'
+
1
;
const
size
_t
MAX_CHOICE
=
'Z'
+
1
;
const
uint64
_t
SECRET_LENGTH
=
5
;
const
size
_t
SECRET_LENGTH
=
5
;
static
inline
page_t
*
init_pages
()
{
static
inline
page_t
*
init_pages
(
void
)
{
return
calloc
(
MAX_CHOICE
,
sizeof
(
page_t
));
return
calloc
(
MAX_CHOICE
,
sizeof
(
page_t
));
}
}
...
@@ -37,4 +32,5 @@ int main() {
...
@@ -37,4 +32,5 @@ int main() {
// TODO: Copy me from the previous stage and edit me so I loop over SECRET_LENGTH characters.
// TODO: Copy me from the previous stage and edit me so I loop over SECRET_LENGTH characters.
printf
(
"
\n
"
);
printf
(
"
\n
"
);
free
(
probe_array
);
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help