mirror of
https://github.com/mfontanini/libtins
synced 2026-01-26 12:01:34 +01:00
Added malformed_packet exception. Every class except Dot11* use it.
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "utils.h"
|
||||
#include "ip.h"
|
||||
#include "rawpdu.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
namespace Tins {
|
||||
UDP::UDP(uint16_t dport, uint16_t sport, PDU *child)
|
||||
@@ -49,7 +50,7 @@ UDP::UDP(uint16_t dport, uint16_t sport, PDU *child)
|
||||
UDP::UDP(const uint8_t *buffer, uint32_t total_sz)
|
||||
{
|
||||
if(total_sz < sizeof(udphdr))
|
||||
throw std::runtime_error("Not enough size for an UDP header in the buffer.");
|
||||
throw malformed_packet();
|
||||
std::memcpy(&_udp, buffer, sizeof(udphdr));
|
||||
total_sz -= sizeof(udphdr);
|
||||
if(total_sz)
|
||||
|
||||
Reference in New Issue
Block a user