Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d64b7e97 authored by IngoZenz's avatar IngoZenz
Browse files

Handle corrupted DNS message with incomplete header

parent 2184ff67
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -18,9 +18,14 @@ public class SimpleDNSMessage {

	
	public SimpleDNSMessage(byte[] data, int offs, int length) throws IOException {

	    this.data = data;
		this.offs = offs;
		this.length = length;

		if (length < 12)
			return; //not a valid message, incomplete header

		rqFlgs = data[offs+2]&0xFF;
		resFlgs = data[offs+3]&0xFF;		
		
@@ -34,7 +39,7 @@ public class SimpleDNSMessage {
	}

    public boolean isStandardQuery() {
        return ( (rqFlgs >> 3) == 0);
		return ( length >= 12 && (rqFlgs >> 3) == 0);
    }
    
    public Object[] getQueryData() {