dumb bug
This commit is contained in:
parent
9c19aa4d33
commit
1aeff9e8a4
1 changed files with 5 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include "header.h"
|
#include "header.h"
|
||||||
#include "question.h"
|
#include "question.h"
|
||||||
#include "record.h"
|
#include "record.h"
|
||||||
|
#include "../io/log.h"
|
||||||
|
|
||||||
void read_packet(PacketBuffer* buffer, Packet* packet) {
|
void read_packet(PacketBuffer* buffer, Packet* packet) {
|
||||||
read_header(buffer, &packet->header);
|
read_header(buffer, &packet->header);
|
||||||
|
@ -16,6 +17,7 @@ void read_packet(PacketBuffer* buffer, Packet* packet) {
|
||||||
for(uint16_t i = 0; i < packet->header.questions; i++) {
|
for(uint16_t i = 0; i < packet->header.questions; i++) {
|
||||||
if (!read_question(buffer, &packet->questions[i])) {
|
if (!read_question(buffer, &packet->questions[i])) {
|
||||||
i--;
|
i--;
|
||||||
|
WARN("J");
|
||||||
packet->header.questions--;
|
packet->header.questions--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,24 +26,25 @@ void read_packet(PacketBuffer* buffer, Packet* packet) {
|
||||||
for(uint16_t i = 0; i < packet->header.answers; i++) {
|
for(uint16_t i = 0; i < packet->header.answers; i++) {
|
||||||
if (!read_record(buffer, &packet->answers[i])) {
|
if (!read_record(buffer, &packet->answers[i])) {
|
||||||
i--;
|
i--;
|
||||||
|
WARN("A");
|
||||||
packet->header.answers--;
|
packet->header.answers--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packet->authorities = malloc(sizeof(Record) * packet->header.authoritative_entries);
|
packet->authorities = malloc(sizeof(Record) * packet->header.authoritative_entries);
|
||||||
for(uint16_t i = 0; i < packet->header.authoritative_entries; i++) {
|
for(uint16_t i = 0; i < packet->header.authoritative_entries; i++) {
|
||||||
read_record(buffer, &packet->authorities[i]);
|
|
||||||
if (!read_record(buffer, &packet->authorities[i])) {
|
if (!read_record(buffer, &packet->authorities[i])) {
|
||||||
i--;
|
i--;
|
||||||
|
WARN("B");
|
||||||
packet->header.authoritative_entries--;
|
packet->header.authoritative_entries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
packet->resources = malloc(sizeof(Record) * packet->header.resource_entries);
|
packet->resources = malloc(sizeof(Record) * packet->header.resource_entries);
|
||||||
for(uint16_t i = 0; i < packet->header.resource_entries; i++) {
|
for(uint16_t i = 0; i < packet->header.resource_entries; i++) {
|
||||||
read_record(buffer, &packet->resources[i]);
|
|
||||||
if (!read_record(buffer, &packet->resources[i])) {
|
if (!read_record(buffer, &packet->resources[i])) {
|
||||||
i--;
|
i--;
|
||||||
|
WARN("C");
|
||||||
packet->header.resource_entries--;
|
packet->header.resource_entries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue