package fuzion24.device.vulnerability.vulnerabilities.framework.graphics;

import android.content.Context;

import fuzion24.device.vulnerability.vulnerabilities.VulnerabilityTest;

/**
 * Created by fuzion24 on 9/15/15.
 */
public class GraphicBufferTest implements VulnerabilityTest {
    static {
        System.loadLibrary("graphicsbufferoverflow");
    }

    @Override
    public String getName() {
        return "CVE-2015-1528/GraphicsBuffer Unflatten";
    }

    private native int checkGraphicsBuffer();

    @Override
    public boolean isVulnerable(Context context) throws Exception {
        int checkVal = checkGraphicsBuffer();

        //TODO: If we declare a different type of socket do we still need internet permission?
        if(checkVal == 0) {
            return false;
        }else if(checkVal == 1) {
            return true;
        }else {
            //TODO: grab more information about failure, errno and error string
            throw new Exception("Error running test");
        }
    }
}

Add java class to run checker
Add java class to run checker
