Skip to content

FIXING main vul #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions modules/pico_dns_client.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*********************************************************************
* PicoTCP-NG
* PicoTCP-NG
* Copyright (c) 2020 Daniele Lacamera <root@danielinux.net>
*
* This file also includes code from:
* PicoTCP
* Copyright (c) 2012-2017 Altran Intelligent Systems
* Authors: Kristof Roelants
*
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
*
* PicoTCP-NG is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -596,9 +596,6 @@ static void pico_dns_client_callback(uint16_t ev, struct pico_socket *s)
}

header = (struct pico_dns_header *)dns_response;
domain = (char *)header + sizeof(struct pico_dns_header);
qsuffix = (struct pico_dns_question_suffix *)pico_dns_client_seek(domain);
/* valid asuffix is determined dynamically later on */

if (pico_dns_client_check_header(header) < 0)
return;
Expand All @@ -607,6 +604,11 @@ static void pico_dns_client_callback(uint16_t ev, struct pico_socket *s)
if (!q)
return;

// FIX: what if the query is not a PTR query?
domain = (char *)header + sizeof(struct pico_dns_header);
qsuffix = (struct pico_dns_question_suffix *)pico_dns_client_seek(domain);
/* valid asuffix is determined dynamically later on */

if (pico_dns_client_check_qsuffix(qsuffix, q) < 0)
return;

Expand Down Expand Up @@ -873,4 +875,3 @@ int pico_dns_client_init(struct pico_stack *S)


#endif /* PICO_SUPPORT_DNS_CLIENT */

Loading
Loading