Skip to content

Commit

Permalink
network: fix potential use-after-free
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Aug 23, 2022
1 parent 8e77d44 commit 0067ba2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion auth-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int unet_auth_data_validate(const uint8_t *key, const void *buf, size_t len,
if (!edsign_verify(&vst, hdr->signature, data->pubkey))
return -3;

if (*(char *)(data + len - 1) != 0)
if (((char *)data)[len - 1] != 0)
return -2;

if (timestamp)
Expand Down
1 change: 1 addition & 0 deletions network.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ static int network_setup(struct network *net)

static void network_teardown(struct network *net)
{
uloop_timeout_cancel(&net->connect_timer);
uloop_timeout_cancel(&net->reload_timer);
network_do_update(net, false);
network_pex_close(net);
Expand Down

0 comments on commit 0067ba2

Please sign in to comment.