From 1aeff9e8a41318cbdb223774f525094e355546c1 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Wed, 12 Apr 2023 14:24:39 -0400 Subject: [PATCH] dumb bug --- src/packet/packet.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/packet/packet.c b/src/packet/packet.c index 07bfccc..cdd4191 100644 --- a/src/packet/packet.c +++ b/src/packet/packet.c @@ -8,6 +8,7 @@ #include "header.h" #include "question.h" #include "record.h" +#include "../io/log.h" void read_packet(PacketBuffer* buffer, Packet* packet) { 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++) { if (!read_question(buffer, &packet->questions[i])) { i--; + WARN("J"); packet->header.questions--; } } @@ -24,24 +26,25 @@ void read_packet(PacketBuffer* buffer, Packet* packet) { for(uint16_t i = 0; i < packet->header.answers; i++) { if (!read_record(buffer, &packet->answers[i])) { i--; + WARN("A"); packet->header.answers--; } } packet->authorities = malloc(sizeof(Record) * packet->header.authoritative_entries); for(uint16_t i = 0; i < packet->header.authoritative_entries; i++) { - read_record(buffer, &packet->authorities[i]); if (!read_record(buffer, &packet->authorities[i])) { i--; + WARN("B"); packet->header.authoritative_entries--; } } packet->resources = malloc(sizeof(Record) * packet->header.resource_entries); for(uint16_t i = 0; i < packet->header.resource_entries; i++) { - read_record(buffer, &packet->resources[i]); if (!read_record(buffer, &packet->resources[i])) { i--; + WARN("C"); packet->header.resource_entries--; } }