node_pcap
node_pcap copied to clipboard
decodeRR endless while loop on malformed dns rr
on malformed packet it finally ends with
FATAL ERROR: JS Allocation failed - process out of memory
while((ch = raw_packet[internal_offset++]) != 0x00) {
result.name += String.fromCharCode(ch);
}
checking ch for not undefined should fix it
while((ch = raw_packet[internal_offset++]) != 0x00) {
if (!ch) {
throw new Error("Malformed DNS RR. Offset is larger than the name length );
}
result.name += String.fromCharCode(ch);
}